diff options
-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) ); }; |