Repository navigation
Cape Town | 26-ITP-Sept | Leigh Ross | Sprint 3 | Build an alarm clock app - #1511
leigh-ross wants to merge 9 commits into
Conversation
…lashes red when alarm goes off.
|
The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look. |
…s the flashing bg, ensure that min time to input is still 0 (no negative numbers), remove red-bg class when alarm is stopped. format using prettier
hackertainment
left a comment
There was a problem hiding this comment.
Your program runs correctly. However, it actually took me quite a while to understand your logic. Since you use two timers (for counting down seconds and flashing respectively) and one nested inside another, it makes the code a bit hard to read and maintain. If you wish, please book a mentored coding session with a volunteer to learn more about the design/planning process. I would mark this PR as completed. Thank you.
| document.getElementById("stop").addEventListener("click", () => { | ||
| document.body.style.backgroundImage = "url('alarmsethamster.jfif')"; | ||
| document.body.style.backgroundPosition = "center"; | ||
| clearInterval(countdownTimer); | ||
| clearInterval(flashTimer); | ||
| document.querySelector(".centre").classList.remove("red-bg"); | ||
| }); |
There was a problem hiding this comment.
The starter code has already listened the click event for the stop element. Adding another listener may cause race condition. Due to the limitation of not modifying starter code, you may consider creating another HTML element for your listener - still not ideal though.
| clearInterval(countdownTimer); | ||
| clearInterval(flashTimer); | ||
|
|
||
| pauseAlarm(); |
There was a problem hiding this comment.
Good use of existing function provided :-)
Learners, PR Template
Self checklist
Task code
CYF-1098
Changelist