Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Created March 20, 2013 16:05
Show Gist options
  • Save wbamberg/5205912 to your computer and use it in GitHub Desktop.
Save wbamberg/5205912 to your computer and use it in GitHub Desktop.
var data = require("sdk/self").data;
require("tabs").open({
url: data.url("page.html"),
onReady: function(tab) {
worker = tab.attach({
contentScriptFile: data.url("script.js")
});
initializeWorker(worker);
}
});
function initializeWorker(worker) {
worker.port.on("hi-main-js", function() {
console.log("got message from content script");
worker.port.emit("hi-content-script")
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment