diff --git a/frontend/webcomponent/src/components/CommandsManager.ts b/frontend/webcomponent/src/components/CommandsManager.ts index 952844d..fdc36a7 100644 --- a/frontend/webcomponent/src/components/CommandsManager.ts +++ b/frontend/webcomponent/src/components/CommandsManager.ts @@ -48,7 +48,7 @@ export class CommandsManager { * @param callback Function to be called when the event is triggered * @returns The component instance for chaining */ - public on(element: HTMLElement, eventName: string, callback: (detail: any) => void): this { + public on(element: HTMLElement, eventName: WebComponentEvent, callback: (detail: any) => void): this { if (!(Object.values(WebComponentEvent) as string[]).includes(eventName)) { console.warn(`Event "${eventName}" is not supported.`); return this; @@ -83,7 +83,7 @@ export class CommandsManager { * @param callback Function to be called when the event is triggered * @returns The component instance for chaining */ - public once(element: HTMLElement, eventName: string, callback: (detail: any) => void): this { + public once(element: HTMLElement, eventName: WebComponentEvent, callback: (detail: any) => void): this { if (!(Object.values(WebComponentEvent) as string[]).includes(eventName)) { console.warn(`Event "${eventName}" is not supported.`); return this; @@ -108,7 +108,7 @@ export class CommandsManager { * @param callback Optional callback to remove (if not provided, removes all handlers for this event) * @returns The component instance for chaining */ - public off(element: HTMLElement, eventName: string, callback?: (detail: any) => void): this { + public off(element: HTMLElement, eventName: WebComponentEvent, callback?: (detail: any) => void): this { if (!callback) { // Remove all handlers for this event const handlers = this.eventHandlers.get(eventName); diff --git a/frontend/webcomponent/src/components/OpenViduMeet.ts b/frontend/webcomponent/src/components/OpenViduMeet.ts index ad5eeb2..e3156b1 100644 --- a/frontend/webcomponent/src/components/OpenViduMeet.ts +++ b/frontend/webcomponent/src/components/OpenViduMeet.ts @@ -174,7 +174,7 @@ export class OpenViduMeet extends HTMLElement { * @param callback Function to be called when the event is triggered * @returns The component instance for chaining */ - public on(eventName: string, callback: (detail: any) => void): this { + public on(eventName: WebComponentEvent, callback: (detail: any) => void): this { this.commandsManager.on(this, eventName, callback); return this; } @@ -185,7 +185,7 @@ export class OpenViduMeet extends HTMLElement { * @param callback Function to be called when the event is triggered * @returns The component instance for chaining */ - public once(eventName: string, callback: (detail: any) => void): this { + public once(eventName: WebComponentEvent, callback: (detail: any) => void): this { this.commandsManager.once(this, eventName, callback); return this; } @@ -196,7 +196,7 @@ export class OpenViduMeet extends HTMLElement { * @param callback Optional callback to remove (if not provided, removes all handlers for this event) * @returns The component instance for chaining */ - public off(eventName: string, callback?: (detail: any) => void): this { + public off(eventName: WebComponentEvent, callback?: (detail: any) => void): this { this.commandsManager.off(this, eventName, callback); return this; }