bus-plus
Version:
bus bus-plus 公交车 mitter 事件订阅 事件发布
18 lines (17 loc) • 535 B
TypeScript
type EventCallback = (...data: any[]) => void;
interface MapEventValue {
once: boolean;
handle: EventCallback;
}
export declare class BusPlus {
maps: Map<string, MapEventValue[]>;
constructor(maps?: Map<any, any>);
private useEvent;
on(key: string, event: EventCallback): this;
once(key: string, event: EventCallback): void;
off(key: string, event?: EventCallback): this;
emit(key: string, ...args: any[]): this;
has(key: string, event?: EventCallback): boolean;
clear(): this;
}
export {};