Created
March 13, 2014 03:39
-
-
Save wbamberg/9521562 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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