summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2024-07-06 23:21:30 -0500
committersanine <sanine.not@pm.me>2024-07-06 23:21:30 -0500
commitfae278000ff919aed473625f704c0a2a62bdf443 (patch)
tree436ff6a0594ac1301fbbf265204be4e30bdde45b
parent3499bfc152ab412c9becb51e1b29ba3ccfe8ac1d (diff)
fix sound loading, maybe?
-rw-r--r--main.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.js b/main.js
index e41a89a..4ec64dc 100644
--- a/main.js
+++ b/main.js
@@ -74,7 +74,10 @@ window.onload = () => setTimeout(() => {
// const level = setupLevel([[2, 2], [3,3]], [7, 7]);
// const ui = setupLevelUi(level, root, audio);
- Promise.all([...Object.values(sfx)].map(x => x.load())).then(
+ Promise.all([...Object.values(sfx)].map(x => new Promise(resolve => {
+ x.load();
+ x.addEventListener('canplaythrough', resolve);
+ }))).then(
() => setupLevelSelectUi(root, sfx)
);
};