fix global lib load bug

This commit is contained in:
lxsang 2021-04-10 18:41:51 +02:00
parent b69103107c
commit cdc11089fa
2 changed files with 8 additions and 18 deletions

Binary file not shown.

View File

@ -1410,7 +1410,6 @@ namespace OS {
}).appendTo("head"); }).appendTo("head");
API.shared[l] = true; API.shared[l] = true;
console.log("Loaded :", l); console.log("Loaded :", l);
announcer.trigger("sharedlibraryloaded", l);
return resolve(undefined); return resolve(undefined);
}) })
.catch((e: Error) => reject(__e(e))); .catch((e: Error) => reject(__e(e)));
@ -1419,7 +1418,6 @@ namespace OS {
.then(function (data: any) { .then(function (data: any) {
API.shared[l] = true; API.shared[l] = true;
console.log("Loaded :", l); console.log("Loaded :", l);
announcer.trigger("sharedlibraryloaded", l);
return resolve(data); return resolve(data);
}) })
.catch((e: Error) => reject(__e(e))); .catch((e: Error) => reject(__e(e)));
@ -1430,7 +1428,6 @@ namespace OS {
} }
} else { } else {
console.log(l, "Library exist, no need to load"); console.log(l, "Library exist, no need to load");
announcer.trigger("sharedlibraryloaded", l);
return resolve(); return resolve();
} }
}); });
@ -1448,21 +1445,14 @@ namespace OS {
if (!(libs.length > 0)) { if (!(libs.length > 0)) {
return resolve(); return resolve();
} }
announcer.observable.one("sharedlibraryloaded", async function ( const l = libs.splice(0, 1)[0];
l return API.requires(l, false)
) { .catch((e: Error) => reject(__e(e)))
libs.splice(0, 1); .then((_l) => {
let r: void; API.require(libs)
try { .then(() => resolve())
r = await API.require(libs); .catch((e) => reject(__e(e)))
} catch (e) {
r = reject(__e(e));
}
return resolve(r);
}); });
return API.requires(libs[0], false).catch((e: Error) =>
reject(__e(e))
);
}); });
} }
/** /**