+ Loading
+diff --git a/common/modules/main.js b/common/modules/main.js index 4614436..79ae8c6 100644 --- a/common/modules/main.js +++ b/common/modules/main.js @@ -42,6 +42,7 @@ export function main(callback, fallbackURL = "../../") { setApps(json.apps); // main(json); callback(json); + loaded(); waitForAllImagesToLoad(); }) .catch(error => { @@ -57,7 +58,7 @@ export function main(callback, fallbackURL = "../../") { // New img element that won't be rendered to the DOM var newImage = document.createElement("img"); // Attach load listener - newImage.addEventListener("load", loaded); + // newImage.addEventListener("load", imageLoaded); // Set src newImage.src = image.src; @@ -66,15 +67,17 @@ export function main(callback, fallbackURL = "../../") { if (event.target.id == "app-icon") { event.target.src = `${fallbackURL}common/assets/img/generic_app.jpeg`; } else event.target.remove() - // loaded(); + // imageLoaded(); }); }); - function loaded() { - if (++count == allImages.length) { - document.querySelector("body").classList.remove("loading"); - document.getElementById("loading").remove(); - } + function imageLoaded() { + if (++count == allImages.length) loaded(); } } + + function loaded() { + document.querySelector("body").classList.remove("loading"); + document.getElementById("loading")?.remove(); + } } diff --git a/view/all-apps/index.html b/view/all-apps/index.html index c5ff393..7e4509d 100644 --- a/view/all-apps/index.html +++ b/view/all-apps/index.html @@ -15,7 +15,11 @@ -
+ +
+ Loading
+
+ Loading
+