From 7986b0461548c2c74b06365f144cddf51da93cbf Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Mon, 14 Nov 2022 15:10:07 -0600 Subject: [PATCH] close #13 refresh page at end of loop --- server/scripts/index.js | 12 +++++++++++- server/scripts/modules/navigation.js | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/scripts/index.js b/server/scripts/index.js index 0f77b69..c66df8f 100644 --- a/server/scripts/index.js +++ b/server/scripts/index.js @@ -465,7 +465,7 @@ const index = (() => { document.getElementById('spanRefreshCountDown').innerHTML = `${dt.getMinutes() < 10 ? `0${dt.getMinutes()}` : dt.getMinutes()}:${dt.getSeconds() < 10 ? `0${dt.getSeconds()}` : dt.getSeconds()}`; // Time has elapsed. - if (AutoRefreshCountMs >= AutoRefreshTotalIntervalMs) LoadTwcData(); + if (AutoRefreshCountMs >= AutoRefreshTotalIntervalMs && !navigation.isPlaying()) LoadTwcData(); }; AutoRefreshIntervalId = window.setInterval(AutoRefreshTimer, AutoRefreshIntervalMs); AutoRefreshTimer(); @@ -537,8 +537,18 @@ const index = (() => { return noSleep.controller.disable(); }; + const refreshCheck = () => { + // Time has elapsed. + if (AutoRefreshCountMs >= AutoRefreshTotalIntervalMs) { + LoadTwcData(); + return true; + } + return false; + }; + return { init, message, + refreshCheck, }; })(); diff --git a/server/scripts/modules/navigation.js b/server/scripts/modules/navigation.js index eafb299..3a67398 100644 --- a/server/scripts/modules/navigation.js +++ b/server/scripts/modules/navigation.js @@ -203,6 +203,10 @@ const navigation = (() => { idx = utils.calc.wrap(curIdx + (i + 1) * direction, totalDisplays); if (displays[idx].status === STATUS.loaded) break; } + // if new display index is less than current display a wrap occurred, test for reload timeout + if (idx <= curIdx) { + if (index.refreshCheck()) return; + } const newDisplay = displays[idx]; // hide all displays hideAllCanvases();