1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00

add daemon

This commit is contained in:
shaoying 2021-04-21 23:18:42 +08:00
parent 9285c9a171
commit b3e1cb739d
4 changed files with 15 additions and 6 deletions

View File

@ -18,7 +18,11 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
search: function(event, can, msg, panel, cmds, cb) {
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)
}); 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, {
"event": event, "can": sub, "msg": msg,

View File

@ -166,6 +166,7 @@ Volcanos("core", {help: "数据结构",
}),
CallFunc: shy("调用器", function(func, args, mod) { args = args||{}
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):
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 ls = func.toString().split(")")[0].split("(")[1].split(",")
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 }
})

View File

@ -78,7 +78,7 @@ Volcanos("user", {help: "用户模块", agent: {
] }]); can.onmotion.story(can, ui.first)
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..." }
}, ui.Close)

View File

@ -24,6 +24,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.page.Modify(can, can._output, {onmouseover: function(event) {
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) {
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) {
can.misc.WSS(can, {type: "chrome", name: name}, cb||function(event, msg, cmd, arg) {
msg && can.run(event, ["search"].concat(msg["detail"]||[]), function(msg) {
_daemon: function(can, msg, target) {
can.misc.WSS(can, {type: "chrome", name: can.user.Search(can, "daemon")}, function(event, msg, cmd, arg) { if (!msg) { return }
can.run(event, ["search"].concat(msg["detail"]||[]), function(msg) {
msg.Reply()
})
})