I've seen this question asked on here before, but there was never really a proper answer. So I have a listener registered on background.js
to listen on chrome.storage.onChanged
. However, as far as I can tell it's not firing the event despite changes to storage. The change happens from the popup.js
file when the user clicks a button.
I have set up a polling button to get the latest data from storage and updates are showing there, but the console.log
calls from the methods listening never get called.
The same item in the storage is being updated, i.e. there are no new items being added or removed. However, I have tested adding different items and it still doesn't fire.
Inside background.js
chrome.storage.onChanged.addListener(function() {
console.log("hehe");
});
Inside popup.js
chrome.storage.sync.set({"databases": dbList}, function () {
console.log("Successfully added: " + domain);
document.getElementById("add-remove").innerText = remove;
setForRemove(dbList, domain)
});
Thanks in advance