mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt chrome
This commit is contained in:
parent
c2070d46cd
commit
93cd46ec2a
@ -150,7 +150,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
||||
can.misc.Log("wss", "detail", msg.detail, msg)
|
||||
can.base.isFunc(cb) && cb(event, msg, msg.detail[0], msg.detail.slice(1))
|
||||
} catch (e) { // 执行失败
|
||||
can.misc.Log(e), msg.Reply(e)
|
||||
can.misc.Log(e), msg.Reply()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1,7 +1,6 @@
|
||||
Volcanos("chrome", {
|
||||
pwd: function(can, msg, cmds, cb) {
|
||||
console.log(cmds)
|
||||
|
||||
cb()
|
||||
},
|
||||
chrome: function(can, msg, cmds, cb) {
|
||||
|
@ -1,4 +1,10 @@
|
||||
Volcanos("chrome", {
|
||||
pwd: function(can, msg, arg, cb) {
|
||||
msg.Push("hi", "hello")
|
||||
msg.Echo("hello")
|
||||
console.log(arg)
|
||||
cb()
|
||||
},
|
||||
spide: function(can, msg) {
|
||||
can.page.Select(can, document.body, "video", function(item) {
|
||||
var p = can.page.Select(can, document.body, "p.title")[0]
|
||||
@ -31,7 +37,9 @@ Volcanos("chrome", {
|
||||
}, [], function(can) { can._load("chrome")
|
||||
chrome.extension.onMessage.addListener(function(req, sender, cb) {
|
||||
var msg = can.request(); can.core.List(req.option, function(key) { msg.Option(key, req[key][0]) })
|
||||
can.core.CallFunc([can, req.detail[3]||"spide"], [can, msg, req.detail.slice(4), cb])
|
||||
can.core.CallFunc([can, req.detail[3]||"spide"], {can: can, msg: msg, arg: req.detail.slice(4), cb: function() {
|
||||
delete(msg._event), delete(msg._can), cb(msg)
|
||||
}})
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user