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

Return storage promise from settings.set().

This commit is contained in:
kkapsner 2018-07-17 12:54:10 +02:00
parent 1f5f5bccc4
commit 9753681651
2 changed files with 11 additions and 6 deletions

View file

@ -68,6 +68,7 @@
value = settings[type + "List"];
}
lists[type] = getDomainRegExpList(value);
return lists[type];
}
Object.keys(lists).forEach(function(type){
settings.on(type + "List", function({newValue}){
@ -107,8 +108,10 @@
return lists[type];
};
scope.appendTo = function appendToList(type, entry){
settings[type + "List"] += (settings[type + "List"]? ",": "") + entry;
updateList(type);
var oldValue = settings[type + "List"];
return settings.set(type + "List", oldValue + (oldValue? ",": "") + entry).then(function(){
return updateList(type);
});
};
scope.update = updateList;
scope.updateAll = function updateAllLists(){