Load promises on startup, correct promise store key

This commit is contained in:
lash 2023-09-05 19:01:53 +01:00
parent e3d2d58950
commit e9d65e6495
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 6 additions and 2 deletions

View File

@ -84,6 +84,7 @@ function checkPersist() {
g_persist.forEach((v) => {
v.put('foo');
});
scanPromises();
}

View File

@ -5,7 +5,7 @@ async function putPromise(o) {
h.update(v);
const z = h.getHash("HEX");
g_persistIndex.push(z);
localStorage.setItem('persist', JSON.stringify(g_persistIndex));
localStorage.setItem(PERSIST_STORAGEKEY, JSON.stringify(g_persistIndex));
for (let i = 0; i < g_persist.length; i++) {
const o = g_persist[i];
const r = await o.put(v);
@ -15,7 +15,10 @@ async function putPromise(o) {
}
async function scanPromises() {
const promises = localStorage.getItem('persist');
const promises = localStorage.getItem(PERSIST_STORAGEKEY);
if (!promises) {
return;
}
const o = JSON.parse(promises);
const eList = document.createElement('ul');
eList.setAttribute('id', 'promiseList');