Via the context-menu
module I detect over which DOM element the user clicked my custom context menu item "Mark":
var menu = require("context-menu").Item({
label: "Mark",
contentScriptFile: data.url("context.js"),
onMessage: function (node) {
//Send the node to page-mod
}
});
context.js
:
self.on("click", function (node, data) {
self.postMessage(node);
});
Now I want to send this node reference to a page-mod
module where every page having the pagemod's contentScript injected gets to know the node I clicked on (and mark the HTML element with a red border in every tab).
I know that sending the message to the pagemod via postMessage()
is not possible, so how can I make these modules communicate? Is there an elegant worker
solution?