Class TypedEventEmitter<E>Abstract
Constructors
Properties
Protected
listeners
listeners: { [K in string | number | symbol]?: (data: E[K]) => void[] } = {} Methods
Protected
emit
- emit<T extends string | number | symbol>(event: T, data: E[T]): void
Type Parameters
- T extends string | number | symbol
Returns void
off
- off<T extends string | number | symbol>(
event: T,
listener: (data: E[T]) => void,
): void Type Parameters
- T extends string | number | symbol
Parameters
- event: T
- listener: (data: E[T]) => void
Returns void
on
- on<T extends string | number | symbol>(
event: T,
listener: (data: E[T]) => void,
): () => void Type Parameters
- T extends string | number | symbol
Parameters
- event: T
- listener: (data: E[T]) => void
Returns () => void
once
- once<T extends string | number | symbol>(
event: T,
listener: (data: E[T]) => void,
): () => void Type Parameters
- T extends string | number | symbol
Parameters
- event: T
- listener: (data: E[T]) => void
Returns () => void
Dispatch an event to all listeners