London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Alarm Clock - #1372
London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Alarm Clock#1372khaliun-dev wants to merge 6 commits into
Conversation
Added displayTime function to show remaining time and updated setAlarm to utilize it.
cjyuan
left a comment
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| function setAlarm() { | ||
| let time = parseInt(document.getElementById("alarmSet").value); |
There was a problem hiding this comment.
Are there any values that need to be rejected to ensure the app works properly?
Refactor alarm time parsing to use parseInt and clean up code.
Add validation to ensure alarm time is a positive integer.
|
@cjyuan i have implemented new code to reject negative numbers and accept whole number only. Also i made sure the old countdown stops before the new one starts. |
cjyuan
left a comment
There was a problem hiding this comment.
After the previous countdown had finished, what would happen if a user started a new countdown without clicking the "Stop Alarm" button first?
| document.getElementById("stop").addEventListener("click", () => { | ||
| clearInterval(interval); | ||
| }); |
There was a problem hiding this comment.
@cjyuan I think i figured it out , the sound for the alarm wasn't stopping when the timer restarts, i have added pauseAlarm to solve that
|
All good. Well done! |
Self checklist
Changelist
Implemented new code in alarmcode.js file.
Updated the page title in index.html to "Alarm clock app".
Questions
None.