From efde89047c0db5933f1c7a15ec4bf08f3bb2b46b Mon Sep 17 00:00:00 2001 From: FoxMoss Date: Wed, 6 Sep 2023 19:00:10 -0500 Subject: [PATCH 1/3] Asyc Dowloads Signed-off-by: FoxMoss --- package.json | 4 ++++ src/oobe/OobeView.tsx | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fa3214aa..0764a434 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,15 @@ }, "homepage": "https://github.com/MercuryWorkshop/AliceWM#readme", "dependencies": { + "@tomphttp/bare-server-node": "^2.0.1", "@typescript-eslint/eslint-plugin": "^5.60.1", "autoprefixer": "^10.4.14", "eslint": "=8.13.0", "eslint-plugin-html": "^7.1.0", "eslint-plugin-jsdoc": "^46.4.3", + "express": "^4.18.2", + "express-basic-auth": "^1.2.1", + "fs-readdir-recursive": "^1.1.0", "onchange": "^7.1.0", "postcss": "^8.4.24", "postcss-cli": "^10.1.0", diff --git a/src/oobe/OobeView.tsx b/src/oobe/OobeView.tsx index bab43c9d..8dfc1d98 100644 --- a/src/oobe/OobeView.tsx +++ b/src/oobe/OobeView.tsx @@ -258,9 +258,11 @@ async function preloadFiles() { * These can safely be ignored, just like the voices in * the developers head. */ + let promises = []; for (const item in list) { - await fetch(list[item]); + promises.push(fetch(list[item])); } + await Promise.all(promises); } catch (e) { console.warn("error durring oobe preload", e); } From 72ec09be29c1ca79b40f7d495553e0fc20af4574 Mon Sep 17 00:00:00 2001 From: FoxMoss Date: Wed, 6 Sep 2023 19:26:22 -0500 Subject: [PATCH 2/3] JS is stupid, made promise array constant Signed-off-by: FoxMoss --- src/oobe/OobeView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oobe/OobeView.tsx b/src/oobe/OobeView.tsx index 8dfc1d98..bac19fbc 100644 --- a/src/oobe/OobeView.tsx +++ b/src/oobe/OobeView.tsx @@ -258,7 +258,7 @@ async function preloadFiles() { * These can safely be ignored, just like the voices in * the developers head. */ - let promises = []; + const promises = []; for (const item in list) { promises.push(fetch(list[item])); } From cc498ee07956c12d1a53aa16029882c8347029a2 Mon Sep 17 00:00:00 2001 From: FoxMoss Date: Wed, 6 Sep 2023 20:13:15 -0500 Subject: [PATCH 3/3] Chunking Preloads Signed-off-by: FoxMoss --- src/oobe/OobeView.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/oobe/OobeView.tsx b/src/oobe/OobeView.tsx index bac19fbc..b2cc7c53 100644 --- a/src/oobe/OobeView.tsx +++ b/src/oobe/OobeView.tsx @@ -258,9 +258,13 @@ async function preloadFiles() { * These can safely be ignored, just like the voices in * the developers head. */ + const chunkSize = 10; const promises = []; for (const item in list) { promises.push(fetch(list[item])); + if (Number(item) % chunkSize === chunkSize - 1) { + await Promise.all(promises); + } } await Promise.all(promises); } catch (e) {