diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-13 11:58:42 +0100 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-13 11:58:42 +0100 |
| commit | 05d2f2f943921d6b5c921686c5edce6eb39d23b8 (patch) | |
| tree | aa49a02006d88f44a57864a51e680f87ef341a7c /timer.js | |
| parent | 367dacb5057c945027775f992edf69884c8fb650 (diff) | |
Cleaned up the code quite a bit
Diffstat (limited to 'timer.js')
| -rw-r--r-- | timer.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -19,7 +19,9 @@ function setSessionData() { function resetTimer() { clearInterval(clock); - setTimer(minsPerRound, 0); + let mins = Math.floor(minsPerRound); + let secs = (minsPerRound - mins) * 60; + setTimer(mins, secs); timerRunningFlag = 0; setSessionData(); } @@ -72,14 +74,14 @@ window.onload = function () { document.getElementById("timer-inc").addEventListener("click", () => { if (timerRunningFlag == 0) { - minsPerRound += 1; + minsPerRound += 0.5; resetTimer(); } }); document.getElementById("timer-dec").addEventListener("click", () => { if (timerRunningFlag == 0 && minsPerRound != 0) { - minsPerRound -= 1; + minsPerRound -= 0.5; resetTimer(); } }); |
