Considering the following example, what would happen when data
is updated?
Since it is an object, will the reference remain and the update be reflected in the contextMenus.onClicked
process?
// background service worker
let data = { ... };
chrome.contextMenus.onClicked.addListener(onClicked);
function onClicked() {
// some process that uses data
}
chrome.storage.onChanged.addListener(onChanged);
function onChanged() {
// update data
}
If SW gets restarted on onChanged.addListener
, and run fresh, would that mean updating data
would not be the right approach and the code should create a new data
?