forked from x/volcanos
add order.js
This commit is contained in:
parent
b3857d213f
commit
601c5d2d1c
4
frame.js
4
frame.js
@ -31,6 +31,10 @@ Volcanos("onaction", {
|
|||||||
}, sub._target)
|
}, sub._target)
|
||||||
},
|
},
|
||||||
remote: function(event, can, msg, pane, cmds, cb) {
|
remote: function(event, can, msg, pane, cmds, cb) {
|
||||||
|
if (can.onengine && can.onengine.remote(event, can, msg, pane, cmds, cb)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (Volcanos.meta.follow[can._root]) { debugger }
|
if (Volcanos.meta.follow[can._root]) { debugger }
|
||||||
Volcanos.meta.debug[can._root] && console.log(can._root, pane._name, "remote", msg._name, "detail", cmds);
|
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) {
|
can.misc.Run(event, can, {names: pane._name}, cmds, function(msg) {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="proto.js"></script>
|
<script src="proto.js"></script>
|
||||||
<script src="page/index.js"></script>
|
<script src="index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ var Preload = Config.libs; Config.panes.forEach(function(pane) {
|
|||||||
Volcanos(Config.name, { _target: document.body,
|
Volcanos(Config.name, { _target: document.body,
|
||||||
_head: document.head, _body: document.body,
|
_head: document.head, _body: document.body,
|
||||||
_width: window.innerWidth, _height: window.innerHeight,
|
_width: window.innerWidth, _height: window.innerHeight,
|
||||||
}, Preload.concat(Config.volcano), function(can) { // 程序入口
|
}, Preload.concat(Config.volcano, "publish/order.js"), function(can) { // 程序入口
|
||||||
can.onimport._init(can, can.Conf(Config), [], function(msg) {
|
can.onimport._init(can, can.Conf(Config), [], function(msg) {
|
||||||
console.log(can._root, can._name, "start", can, msg);
|
console.log(can._root, can._name, "start", can, msg);
|
||||||
can.Footer.onaction._init(can.Footer, msg);
|
can.Footer.onaction._init(can.Footer, msg);
|
36
proto.js
36
proto.js
@ -99,6 +99,42 @@ var Volcanos = shy("火山架", {cache: {}, index: 1, order: 1, debug: {
|
|||||||
return typeof cb == "function" && (res = cb(one, index, array)) && res != undefined && res || one
|
return typeof cb == "function" && (res = cb(one, index, array)) && res != undefined && res || one
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
Clear: function(key) {
|
||||||
|
switch (key) {
|
||||||
|
case "append":
|
||||||
|
case "option":
|
||||||
|
can.core.List(msg[key], function(item) {
|
||||||
|
delete(msg[item])
|
||||||
|
})
|
||||||
|
default:
|
||||||
|
msg[key] = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Push: function(key, value, detail) {msg.append = msg.append || []
|
||||||
|
if (typeof key == "object") {
|
||||||
|
value = value || can.core.Item(key)
|
||||||
|
can.core.List(value, function(item) {
|
||||||
|
detail? msg.Push("key", item).Push("value", key[item]||""):
|
||||||
|
msg.Push(item, key[item]||"")
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < msg.append.length; i++) {
|
||||||
|
if (msg.append[i] == key) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i >= msg.append.length) {msg.append.push(key)}
|
||||||
|
msg[key] = msg[key] || []
|
||||||
|
msg[key].push(""+value+"")
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Echo: shy("输出响应", function(res) {msg.result = msg.result || []
|
||||||
|
msg._hand = true
|
||||||
|
for (var i = 0; i < arguments.length; i++) {msg.result.push(arguments[i])}
|
||||||
|
return msg;
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
|
49
publish/order.js
Normal file
49
publish/order.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
Volcanos("onengine", {
|
||||||
|
river: {
|
||||||
|
one: {name: "some", storm: {
|
||||||
|
one: {name: "some", action: [
|
||||||
|
{name: "show", help: "some"},
|
||||||
|
]},
|
||||||
|
two: {name: "some"},
|
||||||
|
}},
|
||||||
|
two: {name: "some", storm: {
|
||||||
|
one: {name: "some"},
|
||||||
|
two: {name: "two", action: {
|
||||||
|
show: {name: "show", help: "some", inputs: [
|
||||||
|
{type: "text", name: "arg"},
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
three: {name: "some"},
|
||||||
|
},
|
||||||
|
|
||||||
|
remote: function(event, can, msg, pane, cmds, cb) { var meta = can.onengine;
|
||||||
|
return false
|
||||||
|
var river = meta.river[msg.Option("river")]
|
||||||
|
var storm = river && river.storm[msg.Option("storm")]
|
||||||
|
|
||||||
|
msg.Clear("append"); switch (pane._name) {
|
||||||
|
case "River":
|
||||||
|
can.core.Item(meta.river, function(key, value) {
|
||||||
|
msg.Push("key", key)
|
||||||
|
msg.Push("name", value.name)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case "Storm":
|
||||||
|
river && can.core.Item(river.storm, function(key, value) {
|
||||||
|
msg.Push("key", key)
|
||||||
|
msg.Push("name", value.name)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case "Action":
|
||||||
|
storm && can.core.List(storm.action, function(value) {
|
||||||
|
msg.Push("name", value.name)
|
||||||
|
msg.Push("help", value.help)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
typeof cb == "function" && cb(msg);
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
}, [], function(can) { })
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user