import EventEmitter from 'eventemitter3'; import { EventsType } from '../types'; type SuccessType = boolean; type FailType = { code: number; message: string; }; type SuccessReturnType = SuccessType | Promise; type FailReturnType = FailType | Promise; type TaskType = (...args: unknown[]) => SuccessReturnType | FailReturnType; export declare class EventEmitterEx extends EventEmitter { private queueTask; /** * 可对支持被拦截的事件,进行拦截 * @param eventName 事件名 * @param task 任务 */ proxy(eventName: EventsType, task: TaskType): this; /** * 取消拦截器 * @param eventName * @param task */ removeProxy(eventName: EventsType, task: TaskType): this; /** * 执行事件 * @param eventName 事件名 * @param args 需要传递给拦截器的参数 * @example * events.executeProxy('eventName', a, b, c) * .then((value: SuccessType) => { console.log(value) }) * .catch((error: FailType) => { console.log(error) }) */ executeProxy(eventName: EventsType, ...args: unknown[]): Promise; destroy(): void; } export {};