jcommon
Version:
JavaScript 常用纯函数工具库
19 lines (18 loc) • 641 B
TypeScript
/**
* @description: EventBus class
* @author: wuxh
* @Date: 2021-08-24 11:19:07
* @example: const eventBus = new EventBus()
*/
export declare class EventBus {
private listeners;
private maxListener;
constructor();
addListener(event: string, cb: (...args: any[]) => any): void;
emit(event: string, ...args: any[]): void;
getListeners(event: string): Array<(...args: any[]) => any>;
setMaxListeners(maxListener: number): void;
removeListener(event: string, listener: (...args: any[]) => any): void;
removeAllListener(event: string): void;
once(event: string, cb: (...args: any[]) => any): void;
}