index.d.ts 1.51 KB
export declare class Disposable {
    private _disposed;
    private _disposalAction;
    constructor(disposalAction: () => void);
    get disposed(): boolean;
    dispose(): void;
}
export declare class CompositeDisposable {
    private _disposed;
    private _disposables;
    constructor(...disposables: Disposable[]);
    add(disposable: Disposable): void;
    remove(disposable: Disposable): void;
    clear(): void;
    dispose(): void;
}
export declare class Event<T extends (...args: any[]) => any> {
    private emitter;
    private name;
    constructor(emitter: Emitter, name: string | symbol);
    getName(): string | symbol;
    toString(): string;
    on(handler: T, unshift?: boolean): Disposable;
    once(handler: T, unshift?: boolean): Disposable;
    readonly emit: (...a: Parameters<T>) => Promise<ReturnType<T>>[];
}
export declare class Emitter {
    private _disposed;
    private _handlersByEventName;
    get disposed(): boolean;
    clear(): void;
    dispose(): void;
    createEvent<T extends (...args: any[]) => void>(eventName?: string | symbol): Event<T>;
    on(eventName: string | symbol, handler: (...args: any[]) => any, unshift?: boolean): Disposable;
    once(eventName: string | symbol, handler: (...args: any[]) => any, unshift?: boolean): Disposable;
    private off;
    emit(eventName: string | symbol, ...args: any[]): Promise<any>[];
    getEventNames(): string[];
    getEventSymbols(): symbol[];
    listenerCountForEventName(eventName: string | symbol): number;
    getTotalListenerCount(): number;
}