Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Created March 13, 2014 03:39
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/9521562 to your computer and use it in GitHub Desktop.
Save wbamberg/9521562 to your computer and use it in GitHub Desktop.
const defaultState = {
"label": "default label",
"icon": "./default.png",
}
const differentState = {
"label": "different label",
"icon": "./different.png",
}
var { ActionButton } = require("sdk/ui/button/action");
var button = ActionButton({
id: "default-label",
label: "default label",
icon: "./default.png",
onClick: function(state) {
if (button.label == "default label") {
button.state(button, differentState);
}
else {
button.state(button, defaultState);
}
console.log(button.state(button).label);
console.log(button.state(button).icon);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment