summaryrefslogtreecommitdiff
path: root/web/static
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-27 00:53:05 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-27 00:56:26 -0700
commit5dce742cc9593dce4c07233d15e11e1320ef6d13 (patch)
treea4502a21149da2d55da44ecb912740b3f896e14a /web/static
parenta273e90b445ec82a04f92187adfe610cd0703dba (diff)
downloaddartboat-5dce742cc9593dce4c07233d15e11e1320ef6d13.tar.gz
dartboat-5dce742cc9593dce4c07233d15e11e1320ef6d13.tar.xz
web: handle race condition on load
This is incredibly unlikely to ever matter unless your browser is a potato.
Diffstat (limited to 'web/static')
-rw-r--r--web/static/dartboat.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js
index 285a98e..06d9d10 100644
--- a/web/static/dartboat.js
+++ b/web/static/dartboat.js
@@ -209,3 +209,11 @@ document.addEventListener('keydown', e => {
else if (e.key == 'u')
promptHandle('undo');
});
+
+function boatReady() {
+ if (document.readyState === 'loading')
+ document.addEventListener('DOMContentLoaded', () =>
+ Module.ccall('init'));
+ else
+ Module.ccall('init');
+}