From 5fd8f9b04748fba3fc821c41b5da848d9a541485 Mon Sep 17 00:00:00 2001 From: db123 Date: Sun, 26 Apr 2026 00:07:07 +0330 Subject: [PATCH] feat: used new event manager for play button --- src/ui/BaseUI.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/BaseUI.ts b/src/ui/BaseUI.ts index 9a72019..4316fbc 100644 --- a/src/ui/BaseUI.ts +++ b/src/ui/BaseUI.ts @@ -6,11 +6,13 @@ */ import { VP } from "../core"; +import { EventManager } from "../events"; export class BaseUI { private player: VP; private video: HTMLVideoElement; private prefixClass: string; + private events: EventManager; private wrapper!: HTMLElement; private controlsWrap!: HTMLElement; private originalParent!: Node; @@ -20,6 +22,7 @@ export class BaseUI { this.player = player; this.video = video; this.prefixClass = prefixClass; + this.events = new EventManager(); this.build(); this.createPlayButton(); } @@ -51,6 +54,7 @@ export class BaseUI { destroy(): void { this.originalParent.insertBefore(this.video, this.nextSibling); this.wrapper.remove(); + this.events.removeAll(); } private createPlayButton(): void { @@ -62,10 +66,10 @@ export class BaseUI { playButton.innerText = "pause"; } - this.video.addEventListener("play", function (): void { + this.events.add(this.video, "play", function (): void { playButton.innerText = "pause"; }); - this.video.addEventListener("pause", function (): void { + this.events.add(this.video, "pause", function (): void { playButton.innerText = "play"; });