mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-26 11:10:55 +02:00
added hybrid sdk and bootstrapped add-ons transitioning to webextensions.
This commit is contained in:
@@ -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"],
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user