mirror of
https://shylinux.com/x/volcanos
synced 2025-04-26 09:14:06 +08:00
add daemon
This commit is contained in:
parent
9285c9a171
commit
b3e1cb739d
6
frame.js
6
frame.js
@ -18,7 +18,11 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
|||||||
search: function(event, can, msg, panel, cmds, cb) {
|
search: function(event, can, msg, panel, cmds, cb) {
|
||||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
||||||
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
||||||
}); if (!sub || !mod || !fun) { can.base.Warn("not found", cmds[1]); return }
|
}); if (!sub || !mod || !fun) {
|
||||||
|
can.base.Warn("not found", cmds[1])
|
||||||
|
cb(msg.Echo("warn: ", "not found: ", cmds[1]))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return can.core.CallFunc(fun, {
|
return can.core.CallFunc(fun, {
|
||||||
"event": event, "can": sub, "msg": msg,
|
"event": event, "can": sub, "msg": msg,
|
||||||
|
@ -166,6 +166,7 @@ Volcanos("core", {help: "数据结构",
|
|||||||
}),
|
}),
|
||||||
CallFunc: shy("调用器", function(func, args, mod) { args = args||{}
|
CallFunc: shy("调用器", function(func, args, mod) { args = args||{}
|
||||||
var can = args["can"]||args[0], msg = args["msg"]||args[1]
|
var can = args["can"]||args[0], msg = args["msg"]||args[1]
|
||||||
|
var cmds = args["cmds"]||[]
|
||||||
|
|
||||||
func = typeof func == "function"? func: typeof func == "string"? this.Value(mod||can, func):
|
func = typeof func == "function"? func: typeof func == "string"? this.Value(mod||can, func):
|
||||||
typeof func == "object" && func.slice? this.Value(func[0], this.Keys(func.slice(1))): null
|
typeof func == "object" && func.slice? this.Value(func[0], this.Keys(func.slice(1))): null
|
||||||
@ -174,7 +175,7 @@ Volcanos("core", {help: "数据结构",
|
|||||||
var cb = args["cb"]
|
var cb = args["cb"]
|
||||||
var ls = func.toString().split(")")[0].split("(")[1].split(",")
|
var ls = func.toString().split(")")[0].split("(")[1].split(",")
|
||||||
var list = [], echo = false; this.List(ls, function(item, index) { item = item.trim()
|
var list = [], echo = false; this.List(ls, function(item, index) { item = item.trim()
|
||||||
list.push(args[item] || args[index] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) || null)
|
list.push(args[item] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) || cmds[index] || args[index] || null)
|
||||||
if (item == "cb") { echo = true }
|
if (item == "cb") { echo = true }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ Volcanos("user", {help: "用户模块", agent: {
|
|||||||
] }]); can.onmotion.story(can, ui.first)
|
] }]); can.onmotion.story(can, ui.first)
|
||||||
|
|
||||||
ui.Close = function() { can.page.Remove(can, ui.first), timer.stop = true }
|
ui.Close = function() { can.page.Remove(can, ui.first), timer.stop = true }
|
||||||
var timer = can.core.Timer({interval: 100, length: (meta.duration||1000)/100}, function(event, interval, index) {
|
var timer = can.core.Timer({interval: 100, length: (parseInt(meta.duration||1000))/100}, function(event, interval, index) {
|
||||||
if (index > 20) { ui.duration.innerHTML = parseInt(index/10)+"."+(index%10)+"s..." }
|
if (index > 20) { ui.duration.innerHTML = parseInt(index/10)+"."+(index%10)+"s..." }
|
||||||
}, ui.Close)
|
}, ui.Close)
|
||||||
|
|
||||||
|
@ -24,6 +24,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
can.page.Modify(can, can._output, {onmouseover: function(event) {
|
can.page.Modify(can, can._output, {onmouseover: function(event) {
|
||||||
can.menu && can.page.Remove(can, can.menu.first)
|
can.menu && can.page.Remove(can, can.menu.first)
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
can.core.Timer(1000, function() {
|
||||||
|
can.onimport._daemon(can, msg, target)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
_title: function(can, msg, target) {
|
_title: function(can, msg, target) {
|
||||||
can.user.title(can.user.Search(can, "title")||can.user.Search(can, "pod"))
|
can.user.title(can.user.Search(can, "title")||can.user.Search(can, "pod"))
|
||||||
@ -80,9 +84,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
_daemon: function(can, name, cb) {
|
_daemon: function(can, msg, target) {
|
||||||
can.misc.WSS(can, {type: "chrome", name: name}, cb||function(event, msg, cmd, arg) {
|
can.misc.WSS(can, {type: "chrome", name: can.user.Search(can, "daemon")}, function(event, msg, cmd, arg) { if (!msg) { return }
|
||||||
msg && can.run(event, ["search"].concat(msg["detail"]||[]), function(msg) {
|
can.run(event, ["search"].concat(msg["detail"]||[]), function(msg) {
|
||||||
msg.Reply()
|
msg.Reply()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user