Skip to content

Commit

Permalink
added audio file
Browse files Browse the repository at this point in the history
  • Loading branch information
desaisoham0 committed Mar 20, 2024
1 parent e46a1c1 commit 26a34e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<audio id="alarm-sound" src="mixkit-alarm-tone-996.wav" preload="auto"></audio>
<div id="instructions">
<p>Set work and break durations. Use the controls to manage your sessions. Time tracked is displayed below.</p>
</div>
Expand Down
Binary file added mixkit-alarm-tone-996.wav
Binary file not shown.
3 changes: 3 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const workTimeTracked = document.getElementById('work-time-tracked');
const breakTimeTracked = document.getElementById('break-time-tracked');
const workTab = document.getElementById('work-tab');
const breakTab = document.getElementById('break-tab');
const alarmSound = document.getElementById('alarm-sound');

function updateDisplay(timeInSeconds) {
const minutes = Math.floor(timeInSeconds / 60);
Expand Down Expand Up @@ -84,6 +85,8 @@ function startTimer() {
updateTimeTracking();
switchMode(mode === 'work' ? 'break' : 'work'); // Automatically switch modes
startPauseBtn.textContent = '►'; // Change button to show play symbol
// Play the alarm sound when the timer finishes
alarmSound.play();
} else {
updateDisplay(remainingTime);
}
Expand Down

0 comments on commit 26a34e5

Please sign in to comment.