Created
May 23, 2015 17:25
-
-
Save nickrussler/075eab7a209f99984e37 to your computer and use it in GitHub Desktop.
Programatically self-update a Firefox Addon
This file contains hidden or 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 self = require('sdk/self'); | |
const chrome = require('chrome'); | |
/** | |
* Autoupdate this addon on startup | |
*/ | |
(function() { | |
let AddonManager = chrome.Cu.import('resource://gre/modules/AddonManager.jsm', null).AddonManager; | |
AddonManager.getAddonByID(self.id, function(addon) { | |
addon.findUpdates({ | |
onUpdateAvailable: function(addon, install) { | |
install.install(); | |
} | |
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment