diff --git a/extra/shell.html b/extra/shell.html index a4f0c76..acfd3a5 100644 --- a/extra/shell.html +++ b/extra/shell.html @@ -270,6 +270,16 @@ console.error("An error occured!") }; + function preloadList(jsonArray) { + jsonArray.forEach((f) => { + const url = mapping[f.toLowerCase().replace(new RegExp("\\.[^/.]+$"), "")]; + if (!url) return; + + // Preload the asset + fetch('gameasync/' + url).then().catch(); + }); + } + window.fileLoadedAsync = function(file) { document.title = wTitle; @@ -281,13 +291,7 @@ }) .then(function(jsonResponse) { setTimeout(() => { - jsonResponse.forEach((f) => { - const url = mapping[f.toLowerCase().replace(new RegExp("\\.[^/.]+$"), "")]; - if (!url) return; - - // Preload the asset - fetch('gameasync/' + url).then().catch(); - }); + preloadList(jsonResponse); }, 200); }); }; @@ -343,9 +347,27 @@ } document.title = wTitle; - -