From fae278000ff919aed473625f704c0a2a62bdf443 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 6 Jul 2024 23:21:30 -0500 Subject: fix sound loading, maybe? --- main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main.js') 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) ); }; -- cgit v1.2.1