From 67e9217ff67f66d7193e884d8fda53fce0c5d1d2 Mon Sep 17 00:00:00 2001 From: Amit kumar Date: Wed, 17 Jul 2024 17:04:59 +0530 Subject: [PATCH] Update index.js start button disabled once timer starts, otherwise it can be clicked several time and that make timer go bad --- projects/pomodoro-timer/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/pomodoro-timer/index.js b/projects/pomodoro-timer/index.js index 22b4ede..ed6fbc2 100644 --- a/projects/pomodoro-timer/index.js +++ b/projects/pomodoro-timer/index.js @@ -17,6 +17,7 @@ function updateTimer() { } function startTimer() { + startEl.disabled = true; interval = setInterval(() => { timeLeft--; updateTimer(); @@ -29,9 +30,12 @@ function startTimer() { }, 1000); } function stopTimer() { + startEl.disabled = false; clearInterval(interval); + } function resetTimer() { + startEl.disabled = false; clearInterval(interval); timeLeft = 1500; updateTimer();