Move scripts init at the end of HTML page

This commit is contained in:
Cohee
2024-04-27 23:44:08 +03:00
parent 5a4e0a06e6
commit f632888b4c
2 changed files with 70 additions and 58 deletions

View File

@@ -294,6 +294,17 @@ export {
renderTemplate,
};
/**
* Wait for page to load before continuing the app initialization.
*/
await new Promise((resolve) => {
if (document.readyState === 'complete') {
resolve();
} else {
window.addEventListener('load', resolve);
}
});
showLoader();
// Yoink preloader entirely; it only exists to cover up unstyled content while loading JS
document.getElementById('preloader').remove();