import { inspectSymbol } from '../../debugging/inspect.js'; import type { IDisposable } from '../dispose/disposable.js'; import type { EventHandler, EventRegister, IEventEmitter } from './type.js'; declare enum FireErrorAction { Throw = 0, Delay = 1, Ignore = 2, PrintIgnore = 3 } /** * @public */ export declare class Emitter implements IEventEmitter { readonly displayName: string; private readonly onErrorDefault; protected readonly _callbacks: (EventHandler | undefined)[]; private executing; private _something_change_during_call; static readonly EAction: typeof FireErrorAction; constructor(displayName?: string, onErrorDefault?: FireErrorAction); listenerCount(): number; private __fireThrow; private __fireDelay; private __fireIgnore; private __firePrintIgnore; /** * @param data * @param error {Emitter.EAction} 如何处理错误 * - Throw: 默认行为,遇到错误立即抛出,后续监听器不再被调用 * - Delay: 等所有监听器都调用完后,如果有错误则抛出AggregateError,包含所有错误 * - Ignore: 忽略所有错误,继续调用全部监听器 * - PrintIgnore: 忽略所有错误,但打印错误信息 * @returns */ fire(data: T, error?: FireErrorAction): void; /** @deprecated use fire(data, Emitter.Error.Ignore) */ fireNoError(data: T): void; get register(): EventRegister; get event(): EventRegister; /** * 添加监听器 * 这个实例方法已经bind过 */ handle(callback: EventHandler): IDisposable; /** * 添加一次性监听器 */ once(callback: EventHandler): IDisposable; /** * 创建一个等待下次触发的promise */ private _waittings?; wait(): Promise; private checkDeleted; private _disposed; get disposed(): boolean; /** * 运行过程中可以dispose,本次运行仍然会继续到最后 * 但立即不能再次调用类似handle的方法 */ dispose(): void; readonly [Symbol.dispose]: () => void; [inspectSymbol](_depth: number, options: any): string; private requireNotExecuting; } export {}; //# sourceMappingURL=event.d.ts.map