diff --git a/chromium/background.js b/chromium/background.js index 79bf1274df81..c336622f8d26 100644 --- a/chromium/background.js +++ b/chromium/background.js @@ -67,16 +67,19 @@ var httpNowhereOn = false; var showCounter = true; var isExtensionEnabled = true; -storage.get({ - httpNowhere: false, - showCounter: true, - globalEnabled: true -}, function(item) { - httpNowhereOn = item.httpNowhere; - showCounter = item.showCounter; - isExtensionEnabled = item.globalEnabled; - updateState(); -}); +var initializeStoredGlobals = () => { + storage.get({ + httpNowhere: false, + showCounter: true, + globalEnabled: true + }, function(item) { + httpNowhereOn = item.httpNowhere; + showCounter = item.showCounter; + isExtensionEnabled = item.globalEnabled; + updateState(); + }); +} +initializeStoredGlobals(); chrome.storage.onChanged.addListener(function(changes, areaName) { if (areaName === 'sync' || areaName === 'local') { diff --git a/chromium/storage.js b/chromium/storage.js index d75fe7794411..0fed52997fcb 100644 --- a/chromium/storage.js +++ b/chromium/storage.js @@ -3,6 +3,7 @@ if (chrome.storage.sync) { chrome.storage.sync.set({"sync-set-test": true}, () => { if(!chrome.runtime.lastError){ storage = chrome.storage.sync; + initializeStoredGlobals(); } }); }