added hybrid sdk and bootstrapped add-ons transitioning to webextensions.

This commit is contained in:
Luca Greco
2016-09-13 17:36:53 +02:00
parent ed25a238bf
commit eed3665ee8
53 changed files with 689 additions and 0 deletions
@@ -0,0 +1,25 @@
const sp = require("sdk/simple-prefs");
const ss = require("sdk/simple-storage");
ss.storage.superImportantUserStoredData = "This value was saved in the simple-storage";
exports.setSyncLegacyDataPort = function(port) {
// Send the initial data dump.
port.postMessage({
prefs: {
superImportantUserPref: sp.prefs["superImportantUserPref"],
},
storage: {
superImportantUserStoredData: ss.storage.superImportantUserStoredData,
},
});
// Keep the preferences in sync with the data stored in the webextension.
sp.on("superImportantUserPref", () => {
port.postMessage({
prefs: {
superImportantUserPref: sp.prefs["superImportantUserPref"],
}
});
});
};