summaryrefslogtreecommitdiff
path: root/web/static/dartboat.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-02 15:20:34 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-02 15:20:34 -0700
commit237359d107c5f8fb3e1f7a3532696eb19a6c56fc (patch)
tree192f6007e9a59c334477dd6ab6ce209b067614ba /web/static/dartboat.js
parent09c23f60189223db58d98e49ee94df947667662d (diff)
downloaddartboat-237359d107c5f8fb3e1f7a3532696eb19a6c56fc.tar.gz
dartboat-237359d107c5f8fb3e1f7a3532696eb19a6c56fc.tar.xz
web: buffer player info and flush on state change
Constant calls from Wasm to JS to replace unchanged elements in the DOM is not very efficient.
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r--web/static/dartboat.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js
index 8716185..13a5da4 100644
--- a/web/static/dartboat.js
+++ b/web/static/dartboat.js
@@ -98,15 +98,15 @@ function hidePlayerInfo(n) {
}
function updatePlayerName(n, ptr) {
- $(`#p${n}-name`).textContent = UTF8ToString(ptr);
+ $(`#p${n}-name`).textContent = ptr && UTF8ToString(ptr);
}
function updatePlayerRem(n, ptr) {
- $(`#p${n}-rem`).textContent = UTF8ToString(ptr);
+ $(`#p${n}-rem`).textContent = ptr && UTF8ToString(ptr);
}
function updatePlayerSugg(n, ptr) {
- $(`#p${n}-sugg`).textContent = UTF8ToString(ptr);
+ $(`#p${n}-sugg`).textContent = ptr && UTF8ToString(ptr);
}
function updatePlayerAvg(n, avg) {