-
-
Notifications
You must be signed in to change notification settings - Fork 279
London|26-ITP-January|Alexandru Pocovnicu|Sprint 3| alarm clock #1057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
47f91e5
41537a4
3ab9799
8a4ba11
ca62e47
08fbcbd
aa8df3b
950cd4a
4aafd50
dc665e5
b81719d
8354926
063a0fa
5d64c66
c84e2a9
894313e
3b6db49
11d7474
5209ca9
4251c18
a65ca54
6d09014
6799a86
fbb165f
74c4c23
35c4a7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,33 @@ | ||
| function setAlarm() {} | ||
| function setAlarm() { | ||
| const alarmSetEl = document.getElementById("alarmSet"); | ||
| const timeRemainingEl = document.getElementById("timeRemaining"); | ||
| let totalSeconds = +alarmSetEl.value; | ||
| let intervalId; | ||
| function updateCountDown() { | ||
| let seconds = totalSeconds % 60; | ||
| let minutes = (totalSeconds - seconds) / 60; | ||
|
|
||
| let paddedSeconds = seconds.toString().padStart(2, "0"); | ||
| let paddedMinutes = minutes.toString().padStart(2, "0"); | ||
| timeRemainingEl.innerHTML = `Time Remaining: ${paddedMinutes}:${paddedSeconds}`; | ||
|
||
| alarmSetEl.value = null; | ||
|
||
|
|
||
| if (totalSeconds === 0) { | ||
| document.body.classList.add("finish-countdown") | ||
|
|
||
| playAlarm(); | ||
| clearInterval(intervalId); | ||
|
|
||
| return; | ||
| } | ||
| totalSeconds -= 1; | ||
| } | ||
|
|
||
| updateCountDown(); | ||
| intervalId = setInterval(updateCountDown, 1000); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| // DO NOT EDIT BELOW HERE | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.