From a40ce7f2e41258ce9d4d56c22291bf64a0b9cfc1 Mon Sep 17 00:00:00 2001 From: beefchimi Date: Thu, 21 Dec 2023 11:32:35 -0500 Subject: [PATCH] :sparkles: [Sound] Emit volume and mute events --- src/Sound.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Sound.ts b/src/Sound.ts index 6bbb5d7..7d53c54 100644 --- a/src/Sound.ts +++ b/src/Sound.ts @@ -50,6 +50,10 @@ export class Sound extends EmittenCommon { this._volume = newVolume; + if (oldVolume !== newVolume) { + this.emit('volume', newVolume); + } + if (this._mute) return; this.#gainNode.gain @@ -66,6 +70,10 @@ export class Sound extends EmittenCommon { } set mute(value: boolean) { + if (this._mute !== value) { + this.emit('mute', value); + } + this._mute = value; const fromValue = value ? this._volume : 0;