Interface TypedEventEmitter<T>
interface TypedEventEmitter<T> { emit<E>(eventName,
...args): boolean; listeners<E>(event): Function[]; off<E>(eventName,
listener): this; on<E>(eventName,
listener): this; once<E>(eventName,
listener): this; removeAllListeners(eventName?): this; } Methods
emit
- emit<E>(eventName, ...args): boolean
Type Parameters
- E extends string | number | symbol
Parameters
- eventName: E
Rest
...args: Args<T[E]>
Returns boolean
listeners
- listeners<E>(event): Function[]
Type Parameters
- E extends string | number | symbol
Returns Function[]
off
- off<E>(eventName, listener): this
Type Parameters
- E extends string | number | symbol
Parameters
- eventName: E
- listener: ((...args) => void)
- (...args): void
Returns void
Returns this
on
- on<E>(eventName, listener): this
Type Parameters
- E extends string | number | symbol
Parameters
- eventName: E
- listener: ((...args) => void)
- (...args): void
Returns void
Returns this
once
- once<E>(eventName, listener): this
Type Parameters
- E extends string | number | symbol
Parameters
- eventName: E
- listener: ((...args) => void)
- (...args): void
Returns void
Returns this
removeAllListeners
- removeAllListeners(eventName?): this
Parameters
Optional
eventName: keyof T
Returns this