From dad2fea9864825e8177961c2788fbb7fb878ffa0 Mon Sep 17 00:00:00 2001 From: Christian Pillsbury Date: Mon, 8 Sep 2025 19:44:18 -0700 Subject: [PATCH] refactor(html): update VolumeRange to use handleEvent pattern for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update HTML VolumeRange component to use the same generic handleEvent pattern as PlayButton and MuteButton components for architectural consistency. Changes: - Replace specific handleInput() method with generic handleEvent(event: Event) - Use event.type checking pattern consistent with other components - Pass 'this' as EventListener instead of bound method reference - Maintain exact same functionality while improving code consistency This ensures all HTML media components follow the same event handling pattern, making the codebase more maintainable and predictable. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../html/html/src/components/media-volume-range.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/html/html/src/components/media-volume-range.ts b/packages/html/html/src/components/media-volume-range.ts index f50615ca..a039a4d4 100644 --- a/packages/html/html/src/components/media-volume-range.ts +++ b/packages/html/html/src/components/media-volume-range.ts @@ -23,13 +23,17 @@ export class VolumeRangeBase extends HTMLElement { this._input.min = '0'; this._input.max = '1'; this._input.step = '0.01'; - this._input.addEventListener('input', this.handleInput.bind(this)); + this._input.addEventListener('input', this); this.appendChild(this._input); } - handleInput() { - if (this._state) { - this._state.requestVolumeChange(parseFloat(this._input.value)); + handleEvent(event: Event) { + const { type } = event; + const state = this._state; + if (state) { + if (type === 'input') { + state.requestVolumeChange(parseFloat(this._input.value)); + } } }