finalise code

This commit is contained in:
sq 2024-09-22 19:47:09 +08:00 committed by GitHub
parent b959a6b047
commit 657fb6bb3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 23 deletions

View File

@ -11,10 +11,9 @@ for (let elementName in elements) {
}
}
runAfterLoad(function() {
let modDescriptions = {};
let modDescriptions = {};
let fetchPromises = enabledMods.map(mod => {
let fetchPromises = enabledMods.map(mod => {
return fetch(mod)
.then(response => response.text())
.then(data => {
@ -22,9 +21,9 @@ runAfterLoad(function() {
modDescriptions[mod] = data;
})
.catch(error => console.error('Error fetching the mod file: ', error));
});
});
Promise.all(fetchPromises).then(() => {
Promise.all(fetchPromises).then(() => {
Object.keys(elements).forEach(function(elementName) {
let element = elements[elementName];
@ -38,5 +37,4 @@ runAfterLoad(function() {
}
}
});
});
});