index.d.ts
1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
}