BarButton for Mozilla Add-on SDK
Usage
exports.main = function() {
var bb = require("barbutton");
var data = require("self").data;
// create the panel
var panel = require("panel").Panel({
width: 180,
height: 180,
contentURL: "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile"
});
// create the barButton with "id , image and Panel"
let barbutton = bb.BarButton({
id: "firefox-barbutton",
image: data.url("image.png"),
panel:panel
});
};
Screenshot
Options
- id (required)
- image (required)
- panel - a panel to be shown when the user click on the barbutton . (optional)
Methods
collapsed
// hide the barbutton
barbutton.collapsed(true);
// show the barbutton
barbutton.collapsed(false);
setImage
// set Image of the barButton
barbutton.setImage(data.url("image.png"));