From 01f16c46c1001bb77041d45c4f5eec10d9470b4a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 30 Mar 2022 17:26:06 +0200 Subject: Fix race condition when connecting before game specific code is loaded. --- public/common/play.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'public') 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(); +}); -- cgit v1.2.3