fixed JavaScript issue when loading scripts dynamically which caused only the first script to be loaded
This commit is contained in:
parent
23a35cf3c4
commit
f976910730
|
@ -208,14 +208,15 @@ Oqtane.Interop = {
|
|||
bundles.push(scripts[s].bundle);
|
||||
}
|
||||
}
|
||||
const urls = [];
|
||||
const promises = [];
|
||||
for (let b = 0; b < bundles.length; b++) {
|
||||
const urls = [];
|
||||
for (let s = 0; s < scripts.length; s++) {
|
||||
if (scripts[s].bundle === bundles[b]) {
|
||||
urls.push(scripts[s].href);
|
||||
}
|
||||
}
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
if (loadjs.isDefined(bundles[b])) {
|
||||
resolve(true);
|
||||
}
|
||||
|
@ -237,9 +238,10 @@ Oqtane.Interop = {
|
|||
.then(function () { resolve(true) })
|
||||
.catch(function (pathsNotFound) { reject(false) });
|
||||
}
|
||||
});
|
||||
await promise;
|
||||
urls = [];
|
||||
}));
|
||||
}
|
||||
if (promises.length !== 0) {
|
||||
await Promise.all(promises);
|
||||
}
|
||||
},
|
||||
getAbsoluteUrl: function (url) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user