'chrome.storage.sync.set not working in unload event
I've been working on a small Chrome extension and I want to save some stuff to storage whenever the popup closes.
addEventListener("unload", function () {
var background = chrome.extension.getBackgroundPage();
chrome.storage.sync.set({"test": [1,2,3]}, function() {
background.console.log("working");
});
background.updateStorage();
}, true);
The updateStorage function call from the background page works fine, however the storage.sync.set doesn't and I'm not sure why. I've tried the same code in other event listeners, and they all seem to work fine. Is this a problem with unload? Or am I missing something else here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
