mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-17 23:08:33 +02:00
22 lines
486 B
JavaScript
22 lines
486 B
JavaScript
const gettingItem = browser.storage.local.get("prefs");
|
|
gettingItem.then(results => {
|
|
const {prefs} = results || {
|
|
prefs: {
|
|
superImportantUserPref: "default value"
|
|
},
|
|
};
|
|
|
|
const el = document.querySelector("#superImportantUserPref");
|
|
el.value = prefs.superImportantUserPref;
|
|
|
|
const updatePref = () => {
|
|
browser.storage.local.set({
|
|
prefs: {
|
|
superImportantUserPref: el.value,
|
|
},
|
|
});
|
|
};
|
|
|
|
el.addEventListener("input", updatePref);
|
|
});
|