From 5cd4b316489ea4073e3b3b3c6d3b3392555040c9 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 22 Feb 2021 10:53:28 -0800 Subject: [PATCH] fix to do num-based comparison --- xwords4/wasm/xwutils.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xwords4/wasm/xwutils.js b/xwords4/wasm/xwutils.js index b89dfbb93..b63e79b4e 100644 --- a/xwords4/wasm/xwutils.js +++ b/xwords4/wasm/xwutils.js @@ -11,11 +11,10 @@ function ccallString(proc, closure, str) { function registerOnce(devid, gitrev, now) { let nextTimeKey = 'next_reg'; let gitKey = 'last_write'; - let nextTime = localStorage.getItem(nextTimeKey); + let nextTime = parseInt(localStorage.getItem(nextTimeKey)); let prevGit = localStorage.getItem(gitKey); - // false: for now, always register. PENDING - if ( false && prevGit == gitrev && now < nextTime ) { - // console.log("registerOnce: skipping"); + if ( prevGit == gitrev && now < nextTime ) { + console.log('registerOnce(): next in ' + (nextTime - now) + ' secs'); } else { let args = { devid: devid, gitrev: gitrev, @@ -27,7 +26,6 @@ function registerOnce(devid, gitrev, now) { vrntName: 'wasm', }; let body = JSON.stringify(args); - // console.log('registerOnce(): args: ' + body); fetch('/xw4/api/v1/register', { method: 'post',