Skip to content

Commit

Permalink
Merge pull request #13 from nalbam/main
Browse files Browse the repository at this point in the history
fix wav
  • Loading branch information
nalbam authored Oct 10, 2023
2 parents c531b62 + f1bdc90 commit abf5376
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Binary file added public/sounds/ding1.wav
Binary file not shown.
Binary file added public/sounds/ding2.wav
Binary file not shown.
12 changes: 8 additions & 4 deletions public/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Timer {
this.clear();
}

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

start() {
if (!this.time) {
Expand Down Expand Up @@ -139,9 +140,6 @@ 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 Expand Up @@ -218,6 +216,12 @@ class Timer {
if (prebest != nowbest) {
this.bestlap.innerText = nowbest;
this.blink('.bestlap');

this.ding1.loop = false;
this.ding1.play();
} else {
this.ding2.loop = false;
this.ding2.play();
}

this.lastlap.innerText = `Last: ${this.format(this.records[this.records.length - 1])}`;
Expand Down

0 comments on commit abf5376

Please sign in to comment.