summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-03-30 17:26:06 +0200
committerTor Andersson <tor@ccxvii.net>2022-04-03 13:38:29 +0200
commit01f16c46c1001bb77041d45c4f5eec10d9470b4a (patch)
tree78dac7f93236313d3e4b5697a5928d68924ec118 /public
parentaa5bbfd04e85ea8a0c63fe9b8bd220a1898f70a7 (diff)
downloadserver-01f16c46c1001bb77041d45c4f5eec10d9470b4a.tar.gz
Fix race condition when connecting before game specific code is loaded.
Diffstat (limited to 'public')
-rw-r--r--public/common/play.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/public/common/play.js b/public/common/play.js
index 13ce453..b91e4a0 100644
--- a/public/common/play.js
+++ b/public/common/play.js
@@ -845,7 +845,9 @@ async function init_replay() {
}
}
-if (params.mode === "replay")
- init_replay();
-if (params.mode === "play")
- connect_play();
+window.addEventListener("load", function () {
+ if (params.mode === "replay")
+ init_replay();
+ if (params.mode === "play")
+ connect_play();
+});