London | 26-ITP-May | Rizqah Popoola | Sprint 3 | Alarm Clock - #1357
London | 26-ITP-May | Rizqah Popoola | Sprint 3 | Alarm Clock#1357risikatpopoola wants to merge 5 commits into
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
-
If a user enters a time and then clicks the "Set Alarm" button multiple times, the countdown clock will not display properly. Could you fix the issue?
-
Currently when starting a new countdown, the application does not always return to a clean initial state, which can lead to inconsistent behaviour between runs.
Note: a user may not click the "Stop" button first before starting a new count down.
cjyuan
left a comment
There was a problem hiding this comment.
When input is 1, the alarm is played one second later -- an expected behavior.
However, when input is 0, the alarm is also played one second later (instead of being played immediately).
Could you make the app's behaviour more consistent?
| const seconds = String(totalSeconds % 60).padStart(2, "0"); | ||
|
|
||
| timeRemaining.innerText = `Time Remaining: ${minutes}:${seconds}`; | ||
| if (alarmInput.value === "" || totalSeconds < 0 || !Number.isInteger(0)) { |
There was a problem hiding this comment.
- The 3rd condition is always
falseeven iftotalSecondsisNaN.
| timer = setInterval(() => { | ||
| if (totalSeconds <= 0) { | ||
| clearInterval(timer); | ||
| playAlarm(); | ||
| } | ||
| updateTime(totalSeconds--); | ||
| }, 1000); |
There was a problem hiding this comment.
With this change, there will always be a one second delay before the alarm sound.
Could you find a way to get rid the one second delay?
Learners, PR Template
Self checklist