Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Last active June 8, 2016 16:32
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 rhelmer/550ff10edb782c19160756676adc1737 to your computer and use it in GitHub Desktop.
Save rhelmer/550ff10edb782c19160756676adc1737 to your computer and use it in GitHub Desktop.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { utils: Cu, interfaces: Ci, classes: Cc } = Components;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource:///modules/CustomizableUI.jsm");
let gUpgrade;
function startup(data) {
AddonManager.addUpgradeListener(data.instanceID, upgrade => {
gUpgrade = upgrade;
});
CustomizableUI.createWidget({
id: "delay_upgrade",
defaultArea: CustomizableUI.AREA_NAVBAR,
label: "Delay Upgrade",
tooltiptext: "Delay Upgrade",
onCommand: function(aEvent) {
if (gUpgrade) {
console.log("postponed upgrade is pending, applying it now.")
gUpgrade.install();
} else {
console.log("no postponed upgrade is pending.")
}
}
});
}
function shutdown(data) {
AddonManager.removeUpgradeListener(data.instanceID);
CustomizableUI.destroyWidget('delay_upgrade');
}
function install() {}
function uninstall() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment