/*
Log the old value and its new value of
changes in the local storage.
*/
function logStorageChange(changes) {
const changedItems = Object.keys(changes);
for (const item of changedItems) {
console.log(`${item} has changed:`);
console.log("Old value: ", changes[item].oldValue);
console.log("New value: ", changes[item].newValue);
}
}
browser.storage.local.onChanged.addListener(logStorageChange);storage.StorageArea.onChanged / notebook
storage.StorageArea.onChanged
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.