diff --git a/ding.mp3 b/ding.mp3 new file mode 100644 index 0000000..9684c72 Binary files /dev/null and b/ding.mp3 differ diff --git a/index.js b/index.js index cd07e11..4870763 100644 --- a/index.js +++ b/index.js @@ -81,6 +81,7 @@ document.addEventListener('alpine:init', () => { connected: false, isMyTurn: false, _client: null, + _audio: null, init() { Alpine.effect(() => { @@ -109,6 +110,14 @@ document.addEventListener('alpine:init', () => { Alpine.store("localState").nextPlayer = nextPlayer; } }) + + Alpine.effect(() => { + if(this.isMyTurn) { + this._audio.play(); + } + }) + + this._audio = new Audio('ding.mp3'); }, connect() {