diff --git a/lib/misc.js b/lib/misc.js index 0e61450a..b55b72ab 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -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() } } }, diff --git a/publish/chrome/chrome.js b/publish/chrome/chrome.js index e2b666ca..dc23d906 100644 --- a/publish/chrome/chrome.js +++ b/publish/chrome/chrome.js @@ -1,7 +1,6 @@ Volcanos("chrome", { pwd: function(can, msg, cmds, cb) { console.log(cmds) - cb() }, chrome: function(can, msg, cmds, cb) { diff --git a/publish/chrome/contexts.js b/publish/chrome/contexts.js index fe0362e3..58b04055 100644 --- a/publish/chrome/contexts.js +++ b/publish/chrome/contexts.js @@ -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) + }}) }) })