apparently cb can be async... hmm

This commit is contained in:
b 2021-06-19 00:33:39 -07:00
parent 6b52b27585
commit d19a7f79e6
2 changed files with 5 additions and 9 deletions

View file

@ -125,7 +125,7 @@ async function load(init_func) {
// DB not closed? idfk man // DB not closed? idfk man
} }
async function load_init(init_func) { function load_init(init_func) {
if (load_complete) { if (load_complete) {
console.log("Item db already loaded, skipping load sequence"); console.log("Item db already loaded, skipping load sequence");
init_func(); init_func();
@ -137,7 +137,7 @@ async function load_init(init_func) {
console.log("DB failed to open..."); console.log("DB failed to open...");
}; };
request.onsuccess = function() { request.onsuccess = async function() {
db = request.result; db = request.result;
if (!reload) { if (!reload) {
console.log("Using stored data...") console.log("Using stored data...")
@ -146,9 +146,7 @@ async function load_init(init_func) {
else { else {
if (load_in_progress) { if (load_in_progress) {
while (!load_complete) { while (!load_complete) {
(async function () { await sleep(100);
await sleep(100);
}) ()
} }
init_func(); init_func();
} }

View file

@ -137,7 +137,7 @@ function load_init(init_func) {
console.log("DB failed to open..."); console.log("DB failed to open...");
}; };
request.onsuccess = function() { request.onsuccess = async function() {
db = request.result; db = request.result;
if (!reload) { if (!reload) {
console.log("Using stored data...") console.log("Using stored data...")
@ -146,9 +146,7 @@ function load_init(init_func) {
else { else {
if (load_in_progress) { if (load_in_progress) {
while (!load_complete) { while (!load_complete) {
(async function () { await sleep(100);
await sleep(100);
}) ()
} }
init_func(); init_func();
} }