From a88a096af89a4e30d6705d5e20d0b34a77f015c0 Mon Sep 17 00:00:00 2001 From: Lea Date: Thu, 30 Mar 2023 15:49:19 +0200 Subject: [PATCH] Added a Sync Time Feature Sync Time is a time you can set to synchronize with last second subscriptions due to stream delay. Default Value is set to 2 but can be changed in the config. --- config.js | 3 +++ js/script.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index d7ceacb..c2cdb2e 100644 --- a/config.js +++ b/config.js @@ -27,6 +27,9 @@ var initialHoursConfig = 2 var initialMinutesConfig = 0 var initialSecondsConfig = 0 +// Sync Time, amount of seconds it waits after the timer hit 0 to stop it. Useful for last Second Subs. +var syncTime = 2 // Default 2 seconds. + // Enable/Disable Subs, Bits, Donations, Chests var subEnable = true var bitEnable = false diff --git a/js/script.js b/js/script.js index 14cb7c1..ca6360b 100644 --- a/js/script.js +++ b/js/script.js @@ -179,10 +179,12 @@ const getNextTime = () => { let differenceTime = endingTime - currentTime; time = `${timeFunc.getHours(differenceTime)}:${timeFunc.getMinutes(differenceTime)}:${timeFunc.getSeconds(differenceTime)}`; if (differenceTime <= 0) { + time = "00:00:00"; + if (differenceTime <= (syncTime * 1000 * -1)) { clearInterval(countdownUpdater); countdownEnded = true; - time = "00:00:00"; logMessage("Core", "Timer Ended"); + } } if (!paused){ window.localStorage.setItem('initialHours', timeFunc.getHours(differenceTime));