diff --git a/js/main.js b/js/main.js index 6cd76a2..f40dcfd 100644 --- a/js/main.js +++ b/js/main.js @@ -84,6 +84,7 @@ function checkPersist() { g_persist.forEach((v) => { v.put('foo'); }); + scanPromises(); } diff --git a/js/promise.js b/js/promise.js index 97e70b8..436a820 100644 --- a/js/promise.js +++ b/js/promise.js @@ -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');