apparently cb can be async... hmm
This commit is contained in:
parent
6b52b27585
commit
d19a7f79e6
2 changed files with 5 additions and 9 deletions
8
load.js
8
load.js
|
@ -125,7 +125,7 @@ async function load(init_func) {
|
|||
// DB not closed? idfk man
|
||||
}
|
||||
|
||||
async function load_init(init_func) {
|
||||
function load_init(init_func) {
|
||||
if (load_complete) {
|
||||
console.log("Item db already loaded, skipping load sequence");
|
||||
init_func();
|
||||
|
@ -137,7 +137,7 @@ async function load_init(init_func) {
|
|||
console.log("DB failed to open...");
|
||||
};
|
||||
|
||||
request.onsuccess = function() {
|
||||
request.onsuccess = async function() {
|
||||
db = request.result;
|
||||
if (!reload) {
|
||||
console.log("Using stored data...")
|
||||
|
@ -146,9 +146,7 @@ async function load_init(init_func) {
|
|||
else {
|
||||
if (load_in_progress) {
|
||||
while (!load_complete) {
|
||||
(async function () {
|
||||
await sleep(100);
|
||||
}) ()
|
||||
await sleep(100);
|
||||
}
|
||||
init_func();
|
||||
}
|
||||
|
|
6
load3.js
6
load3.js
|
@ -137,7 +137,7 @@ function load_init(init_func) {
|
|||
console.log("DB failed to open...");
|
||||
};
|
||||
|
||||
request.onsuccess = function() {
|
||||
request.onsuccess = async function() {
|
||||
db = request.result;
|
||||
if (!reload) {
|
||||
console.log("Using stored data...")
|
||||
|
@ -146,9 +146,7 @@ function load_init(init_func) {
|
|||
else {
|
||||
if (load_in_progress) {
|
||||
while (!load_complete) {
|
||||
(async function () {
|
||||
await sleep(100);
|
||||
}) ()
|
||||
await sleep(100);
|
||||
}
|
||||
init_func();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue