Skip to content

Instantly share code, notes, and snippets.

Avatar
💭

wbamberg

💭
View GitHub Profile
View gist:8725047
var { Toolbar } = require("sdk/ui/toolbar");
var { Frame } = require("sdk/ui/frame");
var frame1 = new Frame({
url: 'data:text/html;charset=utf-8,blah'
});
var toolbar = Toolbar({
title: "My toolbar",
items: [frame1]
View gist:8722133
require("sdk/preferences/service").set("javascript.options.strict", false);
var { ActionButton } = require('sdk/ui/button/action');
var { Toolbar } = require("sdk/ui/toolbar");
var { Frame } = require("sdk/ui/frame");
var button = ActionButton({
id: "my-button",
label: "my button",
icon: {
View gist:8798330
var { ToggleButton } = require("sdk/ui/button/toggle");
var toggle = ToggleButton({
id: "my-button",
label: "my button",
icon: {
"16": "./firefox-16.png",
"32": "./firefox-32.png"
}
});
View gist:8831590
var { ToggleButton } = require("sdk/ui/button/toggle");
var button = ToggleButton({
id: "my-button",
label: "default",
icon: {
"16": "./firefox-16.png",
"32": "./firefox-32.png"
},
onClick: updateLabelForThisWindow
View gist:8947612
var { ToggleButton } = require("sdk/ui/button/toggle");
var { ActionButton } = require("sdk/ui/button/action");
var toggleButton = ToggleButton({
id: "my-toggle-button",
label: "toggle-default",
icon: {
"16": "./firefox-16.png",
"32": "./firefox-32.png"
},
View gist:9126673
let mdnRequest = require("sdk/request").Request({
url: "https://developer.mozilla.org/en-US/search.json?q=" + currentCssProperty + "&topic=css",
onComplete: showTheDocSummary
});
mdnRequest.get();
...
function showTheDocSummary(response) {
View gist:9264998

Getting started

Prerequisites

To create add-ons for Firefox using the SDK, you'll first need to follow the instructions to install and activate the SDK. Installation is something you only need to do once: activation is something you need to do for each command prompt you open.

Once you've done that, you'll be looking at a command prompt.

If you're on Linux or Mac OS X, the prompt should start with the name of the SDK's root directory:

View gist:9497337
var { Frame } = require("sdk/ui/frame");
var { Toolbar } = require("sdk/ui/toolbar");
/*
<head>
</head>
<body>
<input id="button" type="button" value="click me">
<script type="text/javascript">
View gist:9512931
var { ActionButton } = require('sdk/ui/button/action');
var panels = require("sdk/panel");
var self = require("sdk/self");
var button = ActionButton({
id: "my-button",
label: "my button",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
View gist:9521562
const defaultState = {
"label": "default label",
"icon": "./default.png",
}
const differentState = {
"label": "different label",
"icon": "./different.png",
}