To check out limits: Go to background script, type chrome.storage.sync. then let browser autocomplete
Chrome
Local
their chrome local
chrome.storage.local.set({key: value},function() {console.log('Value is set to '+ value);});chrome.storage.local.get(['key'],function(result) {console.log('Value currently is '+result.key);});
Global
Syncs to google id, their sync must be enabled if not is equivalent to local storage saves
chrome.storage.sync.set({key: value},function() {console.log('Value is set to '+ value);});chrome.storage.sync.get(['key'],function(result) {console.log('Value currently is '+result.key);});
Other
chrome.storage.sync.clear();//to empty storage
Detect Changes
browser.storage.onChanged.addListener((changes, namespace) => {for (let key in changes) {conststorageChange= changes[key];constoldValue=storageChange.oldValue;constnewValue=storageChange.newValue;//not all in `` b/c it abbreivates objs theredebug(`${namespace}${key} changed from`, oldValue,"to", newValue); }});