Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Created May 23, 2014 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbamberg/f9fa87e8712d86ba0543 to your computer and use it in GitHub Desktop.
Save wbamberg/f9fa87e8712d86ba0543 to your computer and use it in GitHub Desktop.
const data = require("sdk/self").data;
const tabs = require("sdk/tabs");
var { ToggleButton } = require("sdk/ui/button/toggle");
var button = ToggleButton({
id: "reddinator",
label: "Reddinator",
icon: {
"16": "./red-16.png",
"32": "./red-32.png"
},
onChange: handleChange
});
function handleChange(state) {
worker = tabs.activeTab.attach({
contentScriptFile: data.url("reddinate.js")
});
// pass the message on to the active tab's content script
worker.postMessage("a");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment