-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug of "move ding" audio playing every time the clock ticked
- Loading branch information
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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,9 +1,15 @@ | ||
let move_audio = new Audio(); | ||
move_audio.src = '/sounds/move.mp3'; | ||
move_audio.src = "/sounds/move.mp3"; | ||
|
||
let moves = 0; | ||
|
||
let UpdateDing = { | ||
updated() { | ||
move_audio.play(); | ||
let new_moves = this.el.getAttribute("data-moves"); | ||
if (new_moves != moves) { | ||
moves = new_moves; | ||
move_audio.play(); | ||
} | ||
} | ||
}; | ||
export default UpdateDing; |
This file contains 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
844ccb6
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.
This must have changed after one of the live view releases.
This block gets redrawn every time the clock changes, however its contents do not change since no moves have been made.
It used to be that the update hook would only fire if the dom contents changed; now the update hook fires even when the contents do not change.