Last active
June 8, 2016 16:32
-
-
Save rhelmer/550ff10edb782c19160756676adc1737 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
/* 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