/** ***************************************** * 事件处理函数 ***************************************** */ declare type Handler = (...args: any[]) => void; /** ***************************************** * 事件对象 ***************************************** */ interface Event { type: string; once: boolean; handler: Handler; } /** ***************************************** * 内置接口 ***************************************** */ export interface EventEmitter { on(type: '$on', handler: (event: Event) => void): this; on(type: '$off', handler: (event: { type?: string; handler?: Handler; }) => void): this; on(type: '$emit', handler: (event: { type: string; args: unknown[]; }) => void): this; once(type: '$on', handler: (event: Event) => void): this; once(type: '$off', handler: (event: { type?: string; handler?: Handler; }) => void): this; once(type: '$emit', handler: (event: { type: string; args: unknown[]; }) => void): this; } /** ***************************************** * 事件派发器 ***************************************** */ export declare class EventEmitter { /** 事件集 */ private $$events; /** 初始化对象 */ constructor(); /** 移除事件 */ off(type?: string, handler?: Handler): this; /** 移除事件 */ emit(type: string, ...args: unknown[]): this; } export {}; //# sourceMappingURL=events.d.ts.map