summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
);
};