1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Added dynamic settings content script

Not yet fully usable due to missing detection in frame.js
This commit is contained in:
kkapsner 2017-11-27 12:28:01 +01:00
parent 2bc0315c5b
commit 5f5d36de23
2 changed files with 55 additions and 7 deletions

View file

@ -176,7 +176,13 @@
};
logging.verbose("loading settings");
scope.loaded = browser.storage.local.get().then(function(storage){
let initialized = false;
const initEvents = [];
scope.init = function(storage){
if (initialized){
return false;
}
initialized = true;
logging.message("settings loaded");
if (!storage.storageVersion){
logging.message("No storage version found. Initializing storage.");
@ -209,14 +215,14 @@
changeValue(name, value);
});
changeValue("isStillDefault", false);
eventHandler.any.forEach(function(callback){
callback();
});
});
initEvents.forEach(function(callback){callback();});
return true;
};
scope.loaded = browser.storage.local.get().then(scope.init);
scope.onloaded = function(callback){
if (scope.isStillDefault){
scope.loaded.then(function(){callback();});
initEvents.push(callback);
}
else {
callback();