Repository navigation
London | 26-ITP-Sep | Chandramani Gaire | Sprint 3 | Alarm clock app #1556
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
Open
gaireprakash20-ops
wants to merge
12
commits into
CodeYourFuture:main
Choose a base branch
from
gaireprakash20-ops:Alarmclock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8b650ca
change the title of the webpage to "Alarm Clock"
gaireprakash20-ops cc86ab6
app also
gaireprakash20-ops 3470b03
Initialise alarm timer
gaireprakash20-ops 7436935
Add time formatting function
gaireprakash20-ops d807e92
function formate time
gaireprakash20-ops e840175
Math.floor and String.padStart to format time in minutes
gaireprakash20-ops 8f149ec
Seconds formatting in formatTime function
gaireprakash20-ops b8be344
Add additional operation to formatTime to include seconds in the output
gaireprakash20-ops 6cfa9c8
function formate for setAlarm
gaireprakash20-ops ee2cf62
time interval formatting to include seconds
gaireprakash20-ops ff5790a
full function test set alarm functionality set innterval and update t…
gaireprakash20-ops 8f549e0
Merge branch 'main' into Alarmclock
gaireprakash20-ops File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,38 @@ | ||
| function setAlarm() {} | ||
| let timer; | ||
| function formatTime(totalSeconds) { | ||
| let minutes = Math.floor(totalSeconds / 60); | ||
| let seconds = totalSeconds % 60; | ||
| return ( | ||
| String(minutes).padStart(2, "0") + ":" + String(seconds).padStart(2, "0") | ||
| ); | ||
| } | ||
| function setAlarm() { | ||
| clearInterval(timer); | ||
| let seconds = Number(document.getElementById("alarmSet").value); | ||
| const title = document.getElementById("timeRemaining"); | ||
|
|
||
| if (!(seconds > 0)) { | ||
| title.innerText = "Time Remaining: 00:00"; | ||
| return; | ||
| } | ||
|
|
||
| title.innerText = "Time Remaining: " + formatTime(seconds); | ||
|
|
||
| timer = setInterval(() => { | ||
| seconds = seconds - 1; | ||
| title.innerText = "Time Remaining: " + formatTime(seconds); | ||
|
|
||
| if (seconds <= 0) { | ||
| clearInterval(timer); | ||
| playAlarm(); | ||
| } | ||
| }, 1000); | ||
| } | ||
|
|
||
| // DO NOT EDIT BELOW HERE | ||
|
|
||
| var audio = new Audio("alarmsound.mp3"); | ||
| let audio = new Audio("alarmsound.mp3"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does changing this declaration fit with the To "like" or "dislike" this comment, please follow this link |
||
|
|
||
| function setup() { | ||
| document.getElementById("set").addEventListener("click", () => { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to the empty
setAlarmdeclaration at the top now that this second declaration has been added?To "like" or "dislike" this comment, please follow this link