diff options
author | sanine <sanine.not@pm.me> | 2024-07-06 23:21:30 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2024-07-06 23:21:30 -0500 |
commit | fae278000ff919aed473625f704c0a2a62bdf443 (patch) | |
tree | 436ff6a0594ac1301fbbf265204be4e30bdde45b /main.js | |
parent | 3499bfc152ab412c9becb51e1b29ba3ccfe8ac1d (diff) |
fix sound loading, maybe?
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) ); }; |