Constructors
Methods
emit
- emit<K>(name, ...data): boolean
Type Parameters
- K extends string | number | symbol
Parameters
- name: K
Rest
...data: Parameters<T[K]>
Returns boolean
canceled 是否被触发取消
hasListener
- hasListener(name): boolean
Returns boolean
off
- off<K>(name?, callback?): void
Type Parameters
- K extends string | number | symbol
Parameters
Optional
name: KOptional
callback: ((...args: Parameters<T[K]>) => ReturnType<T[K]>)- (...args): ReturnType<T[K]>
Parameters
Rest
...args: Parameters<T[K]>
Returns ReturnType<T[K]>
Returns void
on
- on<K>(name, callback, once?): (() => void)
Type Parameters
- K extends string | number | symbol
Parameters
- name: K
- callback: ((...args: Parameters<T[K]>) => ReturnType<T[K]>)
- (...args): ReturnType<T[K]>
Parameters
Rest
...args: Parameters<T[K]>
Returns ReturnType<T[K]>
Optional
once: boolean
Returns (() => void)
解除事件
once
- once<K>(name, callback): (() => void)
Type Parameters
- K extends string | number | symbol
Parameters
- name: K
- callback: ((...args: Parameters<T[K]>) => ReturnType<T[K]>)
- (...args): ReturnType<T[K]>
Parameters
Rest
...args: Parameters<T[K]>
Returns ReturnType<T[K]>
Returns (() => void)
解除事件
waitUnitl
- waitUnitl<K>(name): Promise<Parameters<T[K]>>
Type Parameters
- K extends string | number | symbol
Returns Promise<Parameters<T[K]>>
触发事件的数据
监听者模式
Example