|
|
|
@ -7,6 +7,13 @@ const toBoolean=v => { |
|
|
|
|
if(v=='false' || v==false) return false; |
|
|
|
|
return true; |
|
|
|
|
}; |
|
|
|
|
const notify=(key, value) => { |
|
|
|
|
const interested=watchers[key]; |
|
|
|
|
if(interested) Object |
|
|
|
|
.keys(interested) |
|
|
|
|
.map(key => interested[key]) |
|
|
|
|
.forEach(fn => fn(key, value)); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const get=key => { |
|
|
|
|
let confVal=localStorage.getItem('config.'+key); |
|
|
|
@ -19,14 +26,12 @@ const getS=key => ''+get(key); |
|
|
|
|
|
|
|
|
|
const set=(key, value) => { |
|
|
|
|
localStorage.setItem('config.'+key, value); |
|
|
|
|
let interested=watchers[key]; |
|
|
|
|
if(interested) interested.forEach(watcher => watcher(key, value)); |
|
|
|
|
notify(key, value); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const remove=key => { |
|
|
|
|
localStorage.removeItem('config.'+key, value); |
|
|
|
|
let interested=watchers[key]; |
|
|
|
|
if(interested) interested.forEach(watcher => watcher(key, assets.get('config')[key])); |
|
|
|
|
notify(key, assets.get('config')[key]); |
|
|
|
|
}; |
|
|
|
|
const clear=() => |
|
|
|
|
Object |
|
|
|
|