mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
b0a8a74687
commit
c2444a21d4
193
demo/frame.js
193
demo/frame.js
@ -1,3 +1,43 @@
|
|||||||
|
Volcanos("onimport", {
|
||||||
|
_init: function(can, meta, list, cb, target) {
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
can.core.Next(meta.panes, function(item, next) {
|
||||||
|
can.onappend._init(can, item, Config.libs.concat(item.list), function(pane) {
|
||||||
|
pane.run = function(event, cmds, cb) { var msg = pane.request(event);
|
||||||
|
if (can.onaction[cmds[0]]) {
|
||||||
|
can.onaction[cmds[0]](event, can, msg, pane, cmds, cb);
|
||||||
|
} else {
|
||||||
|
can.onaction[meta.main.engine](event, can, msg, pane, cmds, cb);
|
||||||
|
}
|
||||||
|
}, can[item.name] = pane, next();
|
||||||
|
}, can._target);
|
||||||
|
}, function() { can.onlayout._init(can, meta, list, function() {
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
var pane = can[meta.main.name], msg = can.request(can._event);
|
||||||
|
pane.onaction._init(pane, msg, msg.option||[], cb, target);
|
||||||
|
}, target) });
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onaction", {
|
||||||
|
search: function(event, can, msg, pane, cmds, cb) { var chain = cmds[1]
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
var sub, mod = can, key, fun = can; can.core.List(chain.split("."), function(value, index, array) {
|
||||||
|
fun && (sub = mod, mod = fun, key = value, fun = mod[value])
|
||||||
|
}); if (!sub || !mod || !fun) { console.error("not found", chain); return }
|
||||||
|
|
||||||
|
Volcanos.meta.debug[can._root] && console.log(can._root, can._name, "engine", chain, "match", sub._name+"."+mod._name)
|
||||||
|
typeof fun == "function" && fun(sub, msg, cmds.slice(2), function(value) {
|
||||||
|
typeof cb == "function" && cb(value)
|
||||||
|
}, sub._target)
|
||||||
|
},
|
||||||
|
remote: function(event, can, msg, pane, cmds, cb) {
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
Volcanos.meta.debug[can._root] && console.log(can._root, pane._name, "remote", msg._name, "detail", cmds);
|
||||||
|
can.misc.Run(event, can, {names: pane._name}, cmds, function(msg) {
|
||||||
|
typeof cb == "function" && cb(msg);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
Volcanos("onappend", {
|
Volcanos("onappend", {
|
||||||
_init: function(can, meta, list, cb, target) {
|
_init: function(can, meta, list, cb, target) {
|
||||||
var field = can.onappend.field(can, target, meta.type, meta);
|
var field = can.onappend.field(can, target, meta.type, meta);
|
||||||
@ -6,30 +46,32 @@ Volcanos("onappend", {
|
|||||||
var output = can.page.Select(can, field, "div.output")[0];
|
var output = can.page.Select(can, field, "div.output")[0];
|
||||||
|
|
||||||
// 添加插件
|
// 添加插件
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
var sub = Volcanos(meta.name, { _help: meta.name, _target: field,
|
var sub = Volcanos(meta.name, { _help: meta.name, _target: field,
|
||||||
_option: option, _action: action, _output: output,
|
_option: option, _action: action, _output: output, _history: [],
|
||||||
_history: [],
|
}, [Config.volcano].concat(list), function(sub) {
|
||||||
}, list, function(sub) { sub.Conf(meta);
|
sub.onimport._init(sub, sub.Conf(meta), list, function() {
|
||||||
sub.onimport && sub.onimport._init && sub.onimport._init(sub, meta, [], function() {
|
}, field);
|
||||||
}, output, action, option, field);
|
|
||||||
|
|
||||||
// 添加控件
|
// 添加控件
|
||||||
can.core.Next(typeof meta.inputs == "string"? JSON.parse(meta.inputs||"[]"): meta.inputs || [], function(item, next) {
|
can.core.Next(typeof meta.inputs == "string"? JSON.parse(meta.inputs||"[]"): meta.inputs || [], function(item, next) {
|
||||||
sub[item.name] = Volcanos(item.name, {
|
sub[item.name] = Volcanos(item.name, { _help: item.name,
|
||||||
_target: can.onappend.input(sub, sub._option, "input", item),
|
_target: can.onappend.input(sub, option, item.type, item),
|
||||||
_option: option, _action: action, _output: output,
|
_option: option, _action: action, _output: output,
|
||||||
}, Config.libs.concat(["plugin/input.js"]), function(input) { input.Conf(item);
|
}, Config.libs.concat([item.display||"plugin/input.js"]), function(input) {
|
||||||
|
input.onimport._init(input, input.Conf(item), item.list||[], function() {
|
||||||
|
}, input._target);
|
||||||
|
|
||||||
// 事件回调
|
// 事件回调
|
||||||
input.run = function(event, cmds, cb, silent) {
|
input.run = function(event, cmds, cb, silent) {
|
||||||
|
|
||||||
switch (item.name) {
|
switch (item.name) {
|
||||||
case "返回":
|
case "返回":
|
||||||
// 历史命令
|
// 历史命令
|
||||||
sub._history.pop(); var his = sub._history.pop(); if (his) {
|
sub._history.pop(); var his = sub._history.pop(); if (his) {
|
||||||
can.page.Select(can, option, "input.args", function(item, index) {
|
can.page.Select(can, option, "input.args", function(item, index) {
|
||||||
item.value = his[index] || ""
|
item.value = his[index] || ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析参数
|
// 解析参数
|
||||||
@ -47,63 +89,64 @@ Volcanos("onappend", {
|
|||||||
sub[display] = Volcanos(display, { _target: output,
|
sub[display] = Volcanos(display, { _target: output,
|
||||||
_option: option, _action: action, _output: output,
|
_option: option, _action: action, _output: output,
|
||||||
}, Config.libs.concat(["plugin/"+display]), function(table) {
|
}, Config.libs.concat(["plugin/"+display]), function(table) {
|
||||||
//事件响应
|
table.onimport._init(table, msg, msg.append||[], function() {
|
||||||
table.onimport._init(table, msg, [], function() {
|
}, output)
|
||||||
}, output, action, option)
|
|
||||||
})
|
})
|
||||||
}, silent)
|
}, silent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加事件
|
||||||
can.core.Item(input.onaction, function(key, value) {
|
can.core.Item(input.onaction, function(key, value) {
|
||||||
key.indexOf("on") == 0 && (input._target[key] = function(event) {
|
input._target && key.indexOf("on") == 0 && (input._target[key] = function(event) {
|
||||||
// 事件触发
|
value(event, input);
|
||||||
value(event, input)
|
|
||||||
})
|
})
|
||||||
})
|
}), next();
|
||||||
next()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}); cb(sub);
|
||||||
cb(sub)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
item: function(can, target, type, item, cb, cbs) {
|
item: function(can, target, type, item, cb, cbs) {
|
||||||
var ui = can.page.Append(can, target, [{view: ["item", "div", item.name], click: function(event) {
|
var ui = can.page.Append(can, target, [{view: [type, "div", item.nick||item.name],
|
||||||
cb(event, ui.item)
|
oncontextmenu: function(event) { cbs(event, ui.item) },
|
||||||
}}])
|
click: function(event) {
|
||||||
|
can.page.Select(can, target, "div."+type, function(item) {
|
||||||
|
can.page.ClassList.del(can, item, "select");
|
||||||
|
}); can.page.ClassList.add(can, ui.item, "select");
|
||||||
|
cb(event, ui.item)
|
||||||
|
},
|
||||||
|
}])
|
||||||
return ui.item.Meta = item, ui.item
|
return ui.item.Meta = item, ui.item
|
||||||
},
|
},
|
||||||
field: function(can, target, type, item) {
|
field: function(can, target, type, item) { var dataset = {}; item && item.name && (dataset.names = item.name);
|
||||||
typeof item.help == "string" && item.help.startsWith("[") && (item.help = JSON.parse(item.help))
|
item.help = typeof item.help == "string" && item.help.startsWith("[") && (item.help = JSON.parse(item.help)[0]) || item.help || ""
|
||||||
|
|
||||||
var dataset = {}; item && item.name && (dataset.names = item.name);
|
|
||||||
var field = can.page.Append(can, target, [{view: [(item.name||"")+" "+(type||"")+" "+(item.pos||""), "fieldset"], list: [
|
var field = can.page.Append(can, target, [{view: [(item.name||"")+" "+(type||"")+" "+(item.pos||""), "fieldset"], list: [
|
||||||
item.pos? undefined: {text: [(item.nick||item.name||"")+"("+((typeof item.help == "string"? item.help: item.help.length > 0 && item.help[0])||"")+")", "legend"]},
|
item.pos? undefined: {text: [(item.nick||item.name||"")+"("+(item.help||"")+")", "legend"]},
|
||||||
{view: ["option", "form"], dataset: dataset, list: []},
|
{view: ["option", "form"], dataset: dataset, list: []},
|
||||||
{view: ["action"]}, {view: ["output"]}, {view: ["status"]},
|
{view: ["action"]}, {view: ["output"]}, {view: ["status"]},
|
||||||
]}]).first;
|
]}]).first;
|
||||||
return field.Meta = item, field;
|
return field.Meta = item, field;
|
||||||
},
|
},
|
||||||
input: function(can, option, type, item, cb) {
|
input: function(can, option, type, item, cb) {
|
||||||
var input = {type: "input", name: item.name, data: item};
|
|
||||||
item.action = item.action || item.value || "";
|
|
||||||
item.figure = item.figure || item.value || "";
|
|
||||||
item.cb = item.cb || item.value || "";
|
|
||||||
item.name && item.name.indexOf("@") == 0 && (item.name = item.name.slice(1)) && (item.position = item.position || "opts")
|
item.name && item.name.indexOf("@") == 0 && (item.name = item.name.slice(1)) && (item.position = item.position || "opts")
|
||||||
|
item.figure = item.figure || item.value || "";
|
||||||
|
item.action = item.action || item.value || "";
|
||||||
|
item.cb = item.cb || item.value || "";
|
||||||
|
|
||||||
|
var input = {type: "input", name: item.name, data: item};
|
||||||
switch (item.type = item.type || item._type || item._input || "text") {
|
switch (item.type = item.type || item._type || item._input || "text") {
|
||||||
case "upfile": item.type = "file"; break
|
case "upfile": item.type = "file"; break
|
||||||
case "button":
|
// case "button": item.value = item.value || item.name || "查看"; break
|
||||||
item.value = item.name || item.value;
|
case "button": item.value = item.name || item.value || "查看"; break
|
||||||
break
|
|
||||||
case "select":
|
case "select":
|
||||||
item.values = typeof item.values == "string"? item.values.split(" "): item.values;
|
item.values = typeof item.values == "string"? item.values.split(" "): item.values;
|
||||||
if (!item.values && item.value) {
|
if (!item.values && item.value) {
|
||||||
item.values = item.value.split("|")
|
item.values = item.value.split("|");
|
||||||
item.value = item.values[0]
|
item.value = item.values[0];
|
||||||
}
|
}
|
||||||
input.type = "select", input.list = item.values.map(function(value) {
|
input.type = "select", input.list = item.values.map(function(value) {
|
||||||
return {type: "option", value: value, inner: value};
|
return {type: "option", value: value, inner: value};
|
||||||
})
|
});
|
||||||
item.className || can.page.ClassList.add(can, item, item.position||"args");
|
item.className || can.page.ClassList.add(can, item, item.position||"args");
|
||||||
break
|
break
|
||||||
case "textarea":
|
case "textarea":
|
||||||
@ -117,34 +160,24 @@ Volcanos("onappend", {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.value == "auto") {item.value = ""}
|
var target = can.page.Append(can, option, [{view: ["item "+item.type], list: [item.position && {text: item.name+": "}, input]}]).last
|
||||||
item.figure && item.figure.indexOf("@") == 0 && (item.figure = item.figure.slice(1)) && can.require(["plugin/input/"+item.figure], function() {
|
item.figure && item.figure.indexOf("@") == 0 && (item.figure = item.figure.slice(1)) && can.require(["plugin/input/"+item.figure], function() {
|
||||||
target.type != "button" && (target.value = "")
|
target.type != "button" && (target.value = "")
|
||||||
})
|
})
|
||||||
|
|
||||||
var list = [], style = ""
|
item.type == "textarea" && can.page.Append(can, option, [{type: "br"}]);
|
||||||
switch (type) {
|
|
||||||
case "option":
|
|
||||||
list.push({text: item.name+": "})
|
|
||||||
case "input":
|
|
||||||
style = " "+item.type
|
|
||||||
list.push(input)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
var ui = can.page.Append(can, option, [{view: ["item"+style], list:list}])
|
|
||||||
var target = ui[item.name]
|
|
||||||
if (!target) { return }
|
|
||||||
|
|
||||||
item.type == "text" && !target.placeholder && (target.placeholder = item.name || "");
|
item.type == "text" && !target.placeholder && (target.placeholder = item.name || "");
|
||||||
item.type != "button" && !target.title && (target.title = item.placeholder || item.name || "");
|
item.type != "button" && !target.title && (target.title = item.placeholder);
|
||||||
item.type == "textarea" && can.page.Append(can, option, [{type: "br"}])
|
// item.type == "button" && item.action == "auto" && can.run && can.run({});
|
||||||
item.type == "select" && (target.value = item.value || item.values[item.index||0])
|
item.type == "select" && (target.value = item.value || item.values[item.index||0]);
|
||||||
item.type == "button" && item.action == "auto" && can.run && can.run({});
|
|
||||||
return target;
|
return target;
|
||||||
},
|
},
|
||||||
}, [], function(can) {})
|
}, [], function(can) {})
|
||||||
Volcanos("onlayout", {
|
Volcanos("onlayout", {
|
||||||
start: function(can, target, width, height) {
|
_init: function(can, meta, list, cb, target) {
|
||||||
|
var width = can._width, height = can._height;
|
||||||
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
|
||||||
can.page.Select(can, target, "fieldset.head", function(field) {
|
can.page.Select(can, target, "fieldset.head", function(field) {
|
||||||
height -= field.offsetHeight;
|
height -= field.offsetHeight;
|
||||||
})
|
})
|
||||||
@ -153,31 +186,19 @@ Volcanos("onlayout", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
can.page.Select(can, target, ["fieldset.left", "fieldset.middle", "fieldset.right"], function(field) {
|
can.page.Select(can, target, ["fieldset.left", "fieldset.middle", "fieldset.right"], function(field) {
|
||||||
var border = field.offsetHeight - field.clientHeight
|
var border = field.offsetHeight - field.clientHeight;
|
||||||
can.page.Modify(can, field, {style: {
|
can.page.Modify(can, field, { style: {
|
||||||
height: height-border*2+"px",
|
height: height-border*2+"px",
|
||||||
}})
|
} })
|
||||||
})
|
|
||||||
can.page.Select(can, target, ["fieldset.left>div.output", "fieldset.middle>div.output", "fieldset.right>div.output"], function(field) {
|
|
||||||
var border = field.offsetHeight - field.clientHeight
|
|
||||||
can.page.Modify(can, field, {style: {
|
|
||||||
height: height-border*2-20+"px",
|
|
||||||
}})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
Volcanos("onsearch", {
|
|
||||||
start: function(event, can, chain, cb) {
|
|
||||||
var sub, mod, fun = can, key;
|
|
||||||
can.core.List(chain.split("."), function(value, index, array) {
|
|
||||||
sub = mod, mod = fun, fun = mod[value], key = value
|
|
||||||
})
|
|
||||||
if (!sub || !mod) { console.error("not found", chain); return }
|
|
||||||
|
|
||||||
Volcanos.meta.debug["search"] && console.log("volcano", can._name, "search", chain, "match", sub._name+"."+mod._name)
|
can.page.Select(can, field, "div.output", function(output) {
|
||||||
typeof fun == "function" && fun(event, sub, key, function(value) {
|
var border = output.offsetHeight - output.clientHeight;
|
||||||
Volcanos.meta.debug["search"] && console.log("volcano", can._name, "search", chain, "value", value)
|
can.page.Modify(can, field, { style: {
|
||||||
cb(value)
|
height: height-border*2-20+"px",
|
||||||
|
} })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
typeof cb == "function" && cb()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<script src="proto.js"></script>
|
<script src="proto.js"></script>
|
||||||
<script src="order.js"></script>
|
<script src="order.js"></script>
|
||||||
<script src="start.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
var Config = { volcano: "frame.js", iceberg: "/chat/", intshell: "plug.sh",
|
var Config = {name: "demo", volcano: "frame.js", iceberg: "/chat/", intshell: "plug.sh",
|
||||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], panes: [
|
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"], panes: [
|
||||||
{type: "pane", pos: "head", name: "Header", help: "标题栏", list: ["pane/Header.js", "pane/Header.css"], state: ["time"]},
|
{type: "pane", name: "Header", help: "标题栏", pos: "head", list: ["pane/Header.js", "pane/Header.css"], state: ["time"]},
|
||||||
{type: "pane", pos: "left", name: "River", help: "群聊", list: ["frame.js", "pane/River.js", "pane/River.css"]},
|
{type: "pane", name: "River", help: "群聊组", pos: "left", list: ["pane/River.js", "pane/River.css"]},
|
||||||
{type: "pane", pos: "right", name: "Storm", help: "应用", list: ["frame.js", "pane/Storm.js", "pane/Storm.css"]},
|
{type: "pane", name: "Storm", help: "应用流", pos: "right", list: ["pane/Storm.js", "pane/Storm.css"]},
|
||||||
{type: "pane", pos: "middle", name: "Action", help: "工作台", list: ["frame.js", "pane/Action.js", "pane/Action.css"]},
|
{type: "pane", name: "Action", help: "工作台", pos: "middle", list: ["pane/Action.js", "pane/Action.css"]},
|
||||||
{type: "pane", pos: "foot", name: "Footer", help: "状态栏", list: ["pane/Footer.js", "pane/Footer.css"]},
|
{type: "pane", name: "Footer", help: "状态条", pos: "foot", list: ["pane/Footer.js", "pane/Footer.css"]},
|
||||||
],
|
], main: {name: "Header", engine: "remote", list: []},
|
||||||
|
list: ["plugin/state.js", "plugin/input.js", "plugin/table.js"],
|
||||||
}
|
}
|
||||||
var Preload = []; Config.panes.forEach(function(pane) {
|
|
||||||
|
var Preload = Config.libs; Config.panes.forEach(function(pane) {
|
||||||
Preload = Preload.concat(pane.list);
|
Preload = Preload.concat(pane.list);
|
||||||
|
}); Preload = Preload.concat(Config.list)
|
||||||
|
|
||||||
|
Volcanos(Config.name, { _target: document.body,
|
||||||
|
_head: document.head, _body: document.body,
|
||||||
|
_width: window.innerWidth, _height: window.innerHeight,
|
||||||
|
}, Preload.concat(Config.volcano), function(can) { // 程序入口
|
||||||
|
can.onimport._init(can, can.Conf(Config), [], function(msg) {
|
||||||
|
console.log(can._root, can._name, "start", can, msg);
|
||||||
|
can.Footer.onaction._init(can.Footer, msg);
|
||||||
|
}, can._target)
|
||||||
})
|
})
|
||||||
|
|
||||||
Preload = Preload.concat(["plugin/input.js"])
|
|
||||||
|
@ -1,25 +1,38 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
_init: function(can, meta, list, cb, output, action, option, field) { output.innerHTML = "";
|
_init: function(can, meta, list, cb, target) {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onaction", {help: "交互操作", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) {
|
||||||
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: [],
|
Volcanos("onexport", {help: "导出数据", list: [],
|
||||||
action: function(event, can, key, cb) {
|
_init: function(can, msg, list, cb, target) { var key = "action";
|
||||||
can.run(event, ["search", "River.onexport.river"], function(river) {
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
can.run(event, ["search", "Storm.onexport.storm"], function(storm) {
|
can.run(msg._event, ["search", "Storm.onaction._init"], function(msg) {
|
||||||
can.Cache(can.Conf("river")+can.Conf("storm"), can._output, true)
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
if (can.Cache(can.Conf("river", river)+can.Conf("storm", storm), can._output)) {
|
can.Cache(can.Conf("river")+can.Conf("storm"), can._output, can.Conf(key));
|
||||||
// 缓存恢复
|
var river = can.Conf("river", msg.Option("river"));
|
||||||
return
|
var storm = can.Conf("storm", msg.Option("storm"));
|
||||||
}
|
console.log(can._root, can._name, "show", river, storm);
|
||||||
|
if (can.Conf(key, msg.Option(key, can.Cache(river+"."+storm, can._output)))) {
|
||||||
|
typeof cb == "function" && cb(msg); return
|
||||||
|
}
|
||||||
|
|
||||||
can.run(event, [river, storm], function(msg) { can._output.innerHTML = ""; msg.Table(function(value, index, array) {
|
can.run(msg._event, [river, storm], function(msg) { can._output.innerHTML = "";
|
||||||
can.onappend._init(can, value, Config.libs.concat([]), function(sub) {
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
msg.Table(function(value, index, array) {
|
||||||
|
// 添加列表
|
||||||
|
can.onappend._init(can, value, Config.libs.concat([value.display||"plugin/state.js"]), function(sub) {
|
||||||
sub.run = function(event, cmds, cb, silent) {
|
sub.run = function(event, cmds, cb, silent) {
|
||||||
can.run(event, [river, storm, index].concat(cmds), cb, silent)
|
can.run(event, [river, storm, index].concat(cmds), cb, silent)
|
||||||
}
|
}
|
||||||
console.log("volcano", can._name, "plugin", sub._name)
|
|
||||||
}, can._output)
|
}, can._output)
|
||||||
}) })
|
can.Conf(key, "which")
|
||||||
|
});
|
||||||
|
msg.Option(key, can.Conf(key))
|
||||||
|
typeof cb == "function" && cb(msg)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
_init: function(can, meta, list, cb, output, action, option, field) {output.innerHTML = "";
|
_init: function(can, meta, list, cb, target) {
|
||||||
can.run({}, [], function(msg) {
|
},
|
||||||
console.log("volcano", "Footer", "display", msg.result)
|
})
|
||||||
|
Volcanos("onaction", {help: "交互数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) {
|
||||||
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onexport", {help: "导出数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||||
|
can.run(msg._event, [], function(msg) {
|
||||||
|
console.log(can._root, can._name, "show", msg.result)
|
||||||
can.core.List(msg.result, function(title) {
|
can.core.List(msg.result, function(title) {
|
||||||
can.page.Append(can, output, [{view: ["title", "div", title]}])
|
can.page.Append(can, can._output, [{view: ["title", "div", title]}])
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log("volcano", "Footer", "display", meta.state)
|
console.log(can._root, can._name, "show", can.Conf("state"))
|
||||||
can.ui = can.page.Append(can, output, [{view: "state", list: can.core.List(meta.state, function(item) {
|
can.ui = can.page.Append(can, can._output, [{view: "state", list: can.core.List(can.Conf("state"), function(item) {
|
||||||
return {text: meta[item]||"", className: item, click: function(event) {can.Export(event, meta[item], item)}};
|
return {text: can.Conf(item)||"", className: item, click: function(event) {can.onaction[item](event, can, item)}};
|
||||||
})}])
|
})}])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
ntxt: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
|
||||||
can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state))
|
|
||||||
},
|
|
||||||
ncmd: function(event, can, value, cmd, field) {var state = can.Conf(cmd);
|
|
||||||
can.ui && (can.ui[cmd].innerHTML = cmd+":"+ can.Conf(cmd, can.base.Int(value)+can.base.Int(state)))
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {help: "组件交互", list: []})
|
|
||||||
Volcanos("onchoice", {help: "组件菜单", list: []})
|
|
||||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
|
||||||
Volcanos("onexport", {help: "导出数据", list: []})
|
|
||||||
|
|
||||||
|
@ -1,25 +1,39 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
_init: function(can, meta, list, cb, output, action, option, field) { output.innerHTML = "";
|
_init: function(can, meta, list, cb, target) {
|
||||||
can.run({}, [], function(msg) {
|
},
|
||||||
console.log("volcano", "Header", "display", msg.result)
|
})
|
||||||
|
Volcanos("onaction", {help: "交互数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) {
|
||||||
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
|
can.run(msg._event, ["search", "Footer.onaction._init"], function(msg) {
|
||||||
|
})
|
||||||
|
can.run(msg._event, ["search", "Action.onaction._init"], function(msg) {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
title: function(event, can, key) {
|
||||||
|
},
|
||||||
|
time: function(event, can, key) {
|
||||||
|
can.ui[key].innerHTML = can.base.Time().split(" ")[1]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onexport", {help: "导出数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
|
||||||
|
can.run(msg._event, [], function(msg) {
|
||||||
|
console.log(can._root, can._name, "show", msg.result)
|
||||||
can.core.List(msg.result, function(title) {
|
can.core.List(msg.result, function(title) {
|
||||||
can.page.Append(can, output, [{view: ["title", "div", title],
|
can.page.Append(can, can._output, [{view: ["title", "div", title],
|
||||||
click: function(event) {can.Export(event, meta.title, "title")},
|
click: function(event) {can.onaction["title"](event, can, "title")},
|
||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log("volcano", "Header", "display", meta.state)
|
console.log(can._root, can._name, "show", can.Conf("state"))
|
||||||
can.ui = can.page.Append(can, output, [{view: "state", list: can.core.List(meta.state, function(item) {
|
can.ui = can.page.Append(can, can._output, [{view: "state", list: can.core.List(can.Conf("state"), function(item) {
|
||||||
return {text: meta[item]||"", className: item, click: function(event) {can.Export(event, meta[item], item)}};
|
return {text: can.Conf(item)||"", className: item, click: function(event) {can.onaction[item](event, can, item)}};
|
||||||
})}])
|
})}])
|
||||||
|
|
||||||
can.timer = can.Timer({interval: 1000, length: -1}, function(event) {
|
can.timer = can.Timer({interval: 1000, length: -1}, function(event) {
|
||||||
can.onimport.time(event, can, can.base.Time().split(" ")[1], "time")
|
can.onaction.time(event, can, "time")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return
|
|
||||||
},
|
|
||||||
time: function(event, can, value, cmd, field) {
|
|
||||||
can.ui[cmd].innerHTML = value
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,31 +1,37 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
_init: function(can, meta, list, cb, output, action, option, field) { output.innerHTML = "";
|
_init: function(can, meta, list, cb, target) {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onaction", {help: "交互数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) {
|
||||||
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: [],
|
Volcanos("onexport", {help: "导出数据", list: [],
|
||||||
river: function(event, can, key, cb) {
|
_init: function(can, msg, list, cb, target) { var key = "river";
|
||||||
if (can.Conf(key)) { cb(can.Conf(key)); return }
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
|
if (msg.Option(key, can.Conf(key))) {
|
||||||
|
typeof cb == "function" && cb (msg); return
|
||||||
|
}
|
||||||
|
|
||||||
can.run({}, [], function(msg) { msg.Table(function(value, index, array) {
|
can.run(msg._event, [], function(msg) { can._output.innerHTML = "";
|
||||||
// 添加列表
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
var select; msg.Table(function(value, index, array) {
|
||||||
// 左键点击
|
// 添加列表
|
||||||
can.page.Select(can, can._output, "div.item", function(item) {
|
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
||||||
can.page.ClassList.del(can, item, "select");
|
// 左键点击
|
||||||
}); can.page.ClassList.add(can, item, "select");
|
can.Conf(key, value.key); can.run(event, ["search", "Storm.onaction._init"], function(action) {
|
||||||
|
// 切换群组
|
||||||
can.Conf(key, value.key); can.run({}, ["search", "Action.onexport.action"], function(action) {
|
});
|
||||||
// 切换群组
|
}, function(event) {
|
||||||
})
|
// 右键点击
|
||||||
}, function(event) {
|
});
|
||||||
// 右键点击
|
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
||||||
|
select = view
|
||||||
});
|
}
|
||||||
|
}); select.click();
|
||||||
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
typeof cb == "function" && cb(msg)
|
||||||
view.click()
|
})
|
||||||
}
|
|
||||||
}); cb(can.Conf(key)); })
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,42 +1,41 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: [],
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
_init: function(can, meta, list, cb, output, action, option, field) { output.innerHTML = "";
|
_init: function(can, meta, list, cb, target) {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos("onaction", {help: "交互数据", list: [],
|
||||||
|
_init: function(can, msg, list, cb, target) {
|
||||||
|
can.onexport._init(can, msg, list, cb, target)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: [],
|
Volcanos("onexport", {help: "导出数据", list: [],
|
||||||
storm: function(event, can, key, cb) {
|
_init: function(can, msg, list, cb, target) { var key = "storm";
|
||||||
can.run({}, ["search", "River.onexport.river"], function(river) {
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
if (river == can.Conf("river")) {
|
can.run(msg._event, ["search", "River.onaction._init"], function(msg) {
|
||||||
cb(can.Conf(key))
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
return //当前应用
|
can.Cache(can.Conf("river"), can._output, can.Conf(key));
|
||||||
|
var river = can.Conf("river", msg.Option("river"));
|
||||||
|
console.log(can._root, can._name, "show", river);
|
||||||
|
if (can.Conf(key, msg.Option(key, can.Cache(river, can._output)))) {
|
||||||
|
typeof cb == "function" && cb (msg); return
|
||||||
}
|
}
|
||||||
|
|
||||||
can.Cache(can.Conf("river"), can._output, can.Conf(key))
|
can.run(msg._event, [river], function(msg) { can._output.innerHTML = "";
|
||||||
if (can.Conf(key, can.Cache(can.Conf("river", river), can._output))) {
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
cb(can.Conf(key))
|
var select; msg.Table(function(value, index, array) {
|
||||||
return // 缓存恢复
|
// 添加列表
|
||||||
}
|
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
||||||
|
// 左键点击
|
||||||
can.run({}, [river], function(msg) { msg.Table(function(value, index, array) {
|
can.Conf(key, value.key); can.run(event, ["search", "Action.onaction._init"], function(msg) {
|
||||||
// 添加列表
|
})
|
||||||
var view = can.onappend.item(can, can._output, "item", value, function(event, item) {
|
}, function(event, item) {
|
||||||
// 左键点击
|
// 右键点击
|
||||||
can.page.Select(can, can._output, "div.item", function(item) {
|
});
|
||||||
can.page.ClassList.del(can, item, "select");
|
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
||||||
}); can.page.ClassList.add(can, item, "select");
|
select = view
|
||||||
|
}
|
||||||
can.Conf(key, value.key); can.run({}, ["search", "Action.onexport.action"], function(action) {
|
}); select.click();
|
||||||
// 切换应用
|
typeof cb == "function" && cb(msg)
|
||||||
})
|
})
|
||||||
}, function(event) {
|
|
||||||
// 右键点击
|
|
||||||
|
|
||||||
});
|
|
||||||
if (index == 0 || [value.key, value.name].indexOf(can.user.Search(can, key)) > -1) {
|
|
||||||
view.click()
|
|
||||||
}
|
|
||||||
}); cb(can.Conf(key)); })
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,5 +25,3 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,41 +1,5 @@
|
|||||||
Volcanos("onimport", {help: "导入数据", list: []})
|
Volcanos("onimport", {help: "导入数据", list: [],
|
||||||
Volcanos("onaction", {help: "组件交互", list: []})
|
_init: function(can, meta, list, cb, target) {
|
||||||
Volcanos("onchoice", {help: "组件菜单", list: ["执行", "返回", "共享", "重命名", "选项", "加参", "减参", "克隆", "删除"],
|
|
||||||
"执行": function(event, can, msg, cmd, field) {can.Runs(event)},
|
|
||||||
"返回": function(event, can, msg, cmd, field) {can.Last(event)},
|
|
||||||
"共享": function(event, can, msg, cmd, field) {
|
|
||||||
can.user.input(event, can, ["name", "text"], function(event, cmd, meta, list) {
|
|
||||||
var msg = can.Event(event);
|
|
||||||
msg.Option("name", meta.name)
|
|
||||||
msg.Option("text", meta.text)
|
|
||||||
can.Conf("args", JSON.stringify(can.Option()))
|
|
||||||
can.core.List(["node", "group", "index", "args"], function(key) {
|
|
||||||
msg.Option(key, can.Conf(key))
|
|
||||||
})
|
|
||||||
can.Export(event, "action", "share")
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
"重命名": function(event, can, msg, cmd, field) {var meta = field.Meta;
|
|
||||||
meta.help = can.user.prompt("", function(help) {
|
|
||||||
meta.help = help
|
|
||||||
}, meta.help)
|
|
||||||
},
|
|
||||||
"选项": function(event, can, msg, cmd, field) {
|
|
||||||
can.user.input(event, can, ["name", "value"], function(event, cmd, meta, list) {
|
|
||||||
var data = {type: "text", value: meta.value||""}
|
|
||||||
can.page.ClassList.add(can, data, "opts");
|
|
||||||
|
|
||||||
var input = {type: "input", name: meta.name, data: data};
|
|
||||||
var target = can.Dream(can.option, "option", input)[input.name];
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
"加参": function(event, can, msg, cmd, field) {can.Append()},
|
|
||||||
"减参": function(event, can, msg, cmd, field) {can.Remove(event)},
|
|
||||||
"克隆": function(event, can, msg, cmd, field) {can.Clone(event)},
|
|
||||||
"删除": function(event, can, msg, cmd, field) {can.Delete(event)},
|
|
||||||
})
|
})
|
||||||
Volcanos("ondetail", {help: "组件详情", list: []})
|
|
||||||
Volcanos("onexport", {help: "导出数据", list: []})
|
|
||||||
|
|
||||||
|
@ -4,10 +4,8 @@ Volcanos("onimport", {help: "导入数据", list: [],
|
|||||||
can.page.Select(can, option, "input.args", function(input) { if (input.name == key) {
|
can.page.Select(can, option, "input.args", function(input) { if (input.name == key) {
|
||||||
input.value = value
|
input.value = value
|
||||||
} })
|
} })
|
||||||
|
|
||||||
}, function(event, value, key, index, tr, td) {
|
}, function(event, value, key, index, tr, td) {
|
||||||
});
|
});
|
||||||
|
|
||||||
msg.result && can.page.AppendBoard(can, output, msg.result.join(""))
|
msg.result && can.page.AppendBoard(can, output, msg.result.join(""))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -18,12 +18,13 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
volcano: false, config: true,
|
volcano: false, config: true,
|
||||||
require: true, cache: false, frame: false,
|
require: true, cache: false, frame: false,
|
||||||
request: true, search: true,
|
request: true, search: true,
|
||||||
}}, [], function(name, can, libs, cb) {
|
}, follow: {
|
||||||
var meta = arguments.callee.meta, list = arguments.callee.list;
|
volcano: false, debug: true,
|
||||||
|
}}, [], function(name, can, libs, cb) { var meta = arguments.callee.meta, list = arguments.callee.list;
|
||||||
|
|
||||||
var conf = {}, conf_cb = {}, sync = {}, cache = {};
|
var conf = {}, conf_cb = {}, sync = {}, cache = {};
|
||||||
meta.debug["volcano"] && console.debug("volcano", name, "create");
|
meta.debug[can._root] && console.debug(can._root, name, "create");
|
||||||
can = can || {}, list.push(can) && (can.__proto__ = { _name: name, _create_time: new Date(), _load: function(name) {
|
can = can || {}, list.push(can) && (can.__proto__ = { _name: name, _root: "volcano", _create_time: new Date(), _load: function(name) {
|
||||||
for (var cache = meta.cache[name] || []; meta.index < list.length; meta.index++) {
|
for (var cache = meta.cache[name] || []; meta.index < list.length; meta.index++) {
|
||||||
if (list[meta.index] == can) {continue}
|
if (list[meta.index] == can) {continue}
|
||||||
meta.debug["cache"] && console.debug("cache", name, "load", meta.index, list[meta.index]);
|
meta.debug["cache"] && console.debug("cache", name, "load", meta.index, list[meta.index]);
|
||||||
@ -43,7 +44,7 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
return // 加载完成
|
return // 加载完成
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.debug["require"] && console.debug("volcano", can._name, "require", libs[0]); if (meta.cache[libs[0]]) {
|
meta.debug["require"] && console.debug(can._root, can._name, "require", libs[0]); if (meta.cache[libs[0]]) {
|
||||||
can._load(libs[0]), can.require(libs.slice(1), cb);
|
can._load(libs[0]), can.require(libs.slice(1), cb);
|
||||||
return // 缓存加载
|
return // 缓存加载
|
||||||
}
|
}
|
||||||
@ -53,7 +54,6 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
|
|
||||||
if (source.endsWith(".js")) { var script = document.createElement("script");
|
if (source.endsWith(".js")) { var script = document.createElement("script");
|
||||||
script.src = source, script.onload = function() {
|
script.src = source, script.onload = function() {
|
||||||
// meta.debug["require"] && console.debug("volcano", can._name, "required", libs[0]);
|
|
||||||
can._load(libs[0]), can.require(libs.slice(1), cb);
|
can._load(libs[0]), can.require(libs.slice(1), cb);
|
||||||
} // 加载脚本
|
} // 加载脚本
|
||||||
target.appendChild(script);
|
target.appendChild(script);
|
||||||
@ -61,16 +61,15 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
} else if (source.endsWith(".css")) { var style = document.createElement("link");
|
} else if (source.endsWith(".css")) { var style = document.createElement("link");
|
||||||
style.rel = "stylesheet", style.type = "text/css";
|
style.rel = "stylesheet", style.type = "text/css";
|
||||||
style.href = source; style.onload = function() {
|
style.href = source; style.onload = function() {
|
||||||
// meta.debug["require"] && console.debug("volcano", can._name, "required", libs[0]);
|
|
||||||
can._load(libs[0]), can.require(libs.slice(1), cb);
|
can._load(libs[0]), can.require(libs.slice(1), cb);
|
||||||
} // 加载样式
|
} // 加载样式
|
||||||
target.appendChild(style);
|
target.appendChild(style);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
request: function(event, msg, proto) { event = event || {};
|
request: function(event, msg, proto) { event = event || {};
|
||||||
if (!msg && event.msg) { return event.msg }
|
if (!msg && event._msg) { return event._msg }
|
||||||
|
|
||||||
event.msg = msg = msg || {}, msg.event = event;
|
event._msg = msg = msg || {}, msg._event = event;
|
||||||
msg.__proto__ = proto || { _name: meta.order++, _create_time: new Date(),
|
msg.__proto__ = proto || { _name: meta.order++, _create_time: new Date(),
|
||||||
Option: function(key, val) {
|
Option: function(key, val) {
|
||||||
if (val == undefined) { return msg && msg[key] && msg[key][0] || "" }
|
if (val == undefined) { return msg && msg[key] && msg[key][0] || "" }
|
||||||
@ -78,6 +77,7 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
if (k == key) {return k}
|
if (k == key) {return k}
|
||||||
}).length > 0 || msg.option.push(key)
|
}).length > 0 || msg.option.push(key)
|
||||||
msg[key] = can.core.List(arguments).slice(1)
|
msg[key] = can.core.List(arguments).slice(1)
|
||||||
|
return val
|
||||||
},
|
},
|
||||||
Copy: function(res) { if (!res) { return msg }
|
Copy: function(res) { if (!res) { return msg }
|
||||||
res.result && (msg.result = res.result)
|
res.result && (msg.result = res.result)
|
||||||
@ -103,14 +103,14 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
|
|
||||||
Conf: function(key, value, cb) { if (key == undefined) { return conf }
|
Conf: shy("配置器", function(key, value, cb) { if (key == undefined) { return conf }
|
||||||
if (typeof key == "object") { conf = key; return conf }
|
if (typeof key == "object") { conf = key; return conf }
|
||||||
typeof cb == "function" && (conf_cb[key] = cb);
|
typeof cb == "function" && (conf_cb[key] = cb);
|
||||||
if (value != undefined) {var old = conf[key], res; meta.debug["config"] && console.debug("volcano", can._name, "config", key, value, old)
|
if (value != undefined) {var old = conf[key], res; meta.debug["config"] && console.debug(can._root, can._name, "config", key, value, old)
|
||||||
conf[key] = conf_cb[key] && (res = conf_cb[key](value, old, key)) != undefined && res || value
|
conf[key] = conf_cb[key] && (res = conf_cb[key](value, old, key)) != undefined && res || value
|
||||||
}
|
}
|
||||||
return conf[key] || ""
|
return conf[key] || ""
|
||||||
},
|
}),
|
||||||
Timer: shy("定时器, value, [1,2,3,4], {value, length}", function(interval, cb, cbs) { interval = typeof interval == "object"? interval || []: [interval];
|
Timer: shy("定时器, value, [1,2,3,4], {value, length}", function(interval, cb, cbs) { interval = typeof interval == "object"? interval || []: [interval];
|
||||||
var timer = {stop: false};
|
var timer = {stop: false};
|
||||||
function loop(event, i) {if (timer.stop || i >= interval.length && interval.length >= 0) {return typeof cbs == "function" && cbs(event, interval)}
|
function loop(event, i) {if (timer.stop || i >= interval.length && interval.length >= 0) {return typeof cbs == "function" && cbs(event, interval)}
|
||||||
@ -132,13 +132,12 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cache[name] = {node: temp, data: data}
|
cache[name] = {node: temp, data: data}
|
||||||
console.log("volcano", can._name, "save", name, cache[name]);
|
console.log(can._root, can._name, "save", name, cache[name]);
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = cache[name];
|
var list = cache[name]; if (!list) {return}
|
||||||
if (!list) {return}
|
console.log(can._root, can._name, "load", name, cache[name]);
|
||||||
console.log("volcano", can._name, "load", name, cache[name]);
|
|
||||||
|
|
||||||
// 读缓存
|
// 读缓存
|
||||||
while (list.node.childNodes.length>0) {
|
while (list.node.childNodes.length>0) {
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
Volcanos("demo", { _head: document.head, _body: document.body, _target: document.body,
|
|
||||||
}, [Config.volcano].concat(Config.libs).concat(Preload), function(can) { can.Conf(Config); can.core.Next(can.Conf("panes"), function(item, next) {
|
|
||||||
can.onappend._init(can, item, Config.libs.concat(item.list), function(sub) {
|
|
||||||
sub.run = function(event, cmds, cb, silent) { var msg = sub.request(event);
|
|
||||||
switch (cmds[0]) {
|
|
||||||
case "search":
|
|
||||||
can.onsearch.start(event, can, cmds[1], cb)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送请求
|
|
||||||
Volcanos.meta.debug["request"] && console.log("volcano", sub._name, "request", msg._name, cmds, msg);
|
|
||||||
can.misc.Run(event, can, {names: item.name}, cmds, function(msg) {
|
|
||||||
// 接收响应
|
|
||||||
Volcanos.meta.debug["request"] && console.log("volcano", sub._name, "response", msg._name, msg.result, msg);
|
|
||||||
cb(msg);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
can[item.name] = sub, next()
|
|
||||||
}, can._target);
|
|
||||||
}, function() {
|
|
||||||
// 启动入口
|
|
||||||
can.onlayout.start(can, can._target, window.innerWidth, window.innerHeight);
|
|
||||||
console.log("volcano", "demo", "start", can);
|
|
||||||
can.Action.onexport.action({}, can.Action, function() {
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user