Interface Events
interface Events {
dispatch: <T>(event: string, data: T) => void;
emit: <T>(event: string, data: T) => void;
listen: <T>(event: string, callback: EventCallback<T>) => void;
off: <T>(event: string, callback: EventCallback<T>) => void;
on: <T>(event: string, callback: EventCallback<T>) => void;
unlisten: <T>(event: string, callback: EventCallback<T>) => void;
clear(): void;
}
dispatch: <T>(event: string, data: T) => void;
emit: <T>(event: string, data: T) => void;
listen: <T>(event: string, callback: EventCallback<T>) => void;
off: <T>(event: string, callback: EventCallback<T>) => void;
on: <T>(event: string, callback: EventCallback<T>) => void;
unlisten: <T>(event: string, callback: EventCallback<T>) => void;
clear(): void;
}
Properties
dispatch
Dispatch an event with data
emit
Alias for dispatch
listen
Alias for on
Type declaration
- <T>(event: string, callback: EventCallback<T>): void
Type Parameters
Parameters
- event: string
Event name
- callback: EventCallback<T>
Event handler
Returns void
- event: string
off
Remove an event listener
Type declaration
- <T>(event: string, callback: EventCallback<T>): void
Type Parameters
Parameters
- event: string
Event name
- callback: EventCallback<T>
Event handler
Returns void
- event: string
on
Add an event listener
Type declaration
- <T>(event: string, callback: EventCallback<T>): void
Type Parameters
Parameters
- event: string
Event name
- callback: EventCallback<T>
Event handler
Returns void
- event: string
unlisten
Alias for off
Type declaration
- <T>(event: string, callback: EventCallback<T>): void
Type Parameters
Parameters
- event: string
Event name
- callback: EventCallback<T>
Event handler
Returns void
- event: string
Interface for event handling functionality