change localStorage scheme and also rpolly more I forgor
This commit is contained in:
parent
d6d84423e0
commit
9ec9c55912
8 changed files with 186 additions and 73 deletions
|
@ -1 +1,19 @@
|
|||
app=Elm.Main.init({flags:localStorage.getItem('cookies')?JSON.parse(localStorage.getItem('cookies')):''});app.ports.setStorage.subscribe(function(c){localStorage.setItem('cookies',JSON.stringify(c))});
|
||||
const flags =
|
||||
{ Theme: storedObject('Theme')
|
||||
, Prompt: storedObject('Prompt')
|
||||
, Font: storedObject('Font')
|
||||
, CookiesStored: storedObject('CookiesStored')
|
||||
}
|
||||
console.log(flags);
|
||||
app = Elm.Main.init({flags:flags});
|
||||
console.log(storedObject('cookies'));
|
||||
app.ports.setStorage.subscribe(function(kc){const [k,c]=kc;localStorage.setItem(k,JSON.stringify(c))});
|
||||
app.ports.getStorage.subscribe(function(k){
|
||||
const n = k;
|
||||
const d = storedObject(k);
|
||||
const ret =
|
||||
{ name: n
|
||||
, data: d
|
||||
};
|
||||
app.ports.receiveStorageFromJS.send(ret)});
|
||||
function storedObject(k) {return localStorage.getItem(k)?JSON.parse(localStorage.getItem(k)):null;};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue