How to refactor global variables from MV2 to using chrome.storage in MV3 service worker?
The number of variables in the state doesn’t change the approach: read the state on the start of the script save the state on change For small data (1MB total) use chrome.storage.session, which is in-memory i.e. it doesn’t write to disk, otherwise use chrome.storage.local. Both can only store JSON-compatible types i.e. string, number, boolean, null, … Read more