Skip to content

Commit

Permalink
Merge pull request #12 from nalbam/main
Browse files Browse the repository at this point in the history
add success sound
  • Loading branch information
nalbam authored Oct 10, 2023
2 parents 774b630 + 845ff64 commit c531b62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Binary file added public/sounds/success.mp3
Binary file not shown.
5 changes: 5 additions & 0 deletions public/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Timer {
this.clear();
}

success = new Audio('/sounds/success.mp3');

start() {
if (!this.time) {
this.time = performance.now();
Expand Down Expand Up @@ -137,6 +139,9 @@ class Timer {
// Save the lap time
this.records.push(this.times);

this.success.loop = false;
this.success.play();

let li = document.createElement('li');
li.innerText = this.format(this.times);
this.results.appendChild(li);
Expand Down

0 comments on commit c531b62

Please sign in to comment.