1 | import { Event, Emitter } from './event';
|
2 | export interface Disposable {
|
3 | |
4 |
|
5 |
|
6 | dispose(): void;
|
7 | }
|
8 | export declare namespace Disposable {
|
9 | function is(arg: unknown): arg is Disposable;
|
10 | function create(func: () => void): Disposable;
|
11 |
|
12 | const NULL: Disposable;
|
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 DisposableCollection implements Disposable {
|
43 | protected readonly disposables: Disposable[];
|
44 | protected readonly onDisposeEmitter: Emitter<void>;
|
45 | constructor(...toDispose: Disposable[]);
|
46 | /**
|
47 | * This event is fired only once
|
48 | * on first dispose of not empty collection.
|
49 | */
|
50 | get onDispose(): Event<void>;
|
51 | protected checkDisposed(): void;
|
52 | get disposed(): boolean;
|
53 | private disposingElements;
|
54 | dispose(): void;
|
55 | push(disposable: Disposable): Disposable;
|
56 | pushAll(disposables: Disposable[]): Disposable[];
|
57 | }
|
58 | export type DisposableGroup = {
|
59 | push(disposable: Disposable): void;
|
60 | } | {
|
61 | add(disposable: Disposable): void;
|
62 | };
|
63 | export declare namespace DisposableGroup {
|
64 | function canPush(candidate?: DisposableGroup): candidate is {
|
65 | push(disposable: Disposable): void;
|
66 | };
|
67 | function canAdd(candidate?: DisposableGroup): candidate is {
|
68 | add(disposable: Disposable): void;
|
69 | };
|
70 | }
|
71 | export declare function disposableTimeout(...args: Parameters<typeof setTimeout>): Disposable;
|
72 |
|
73 |
|
74 |
|
75 | export declare class DisposableWrapper implements Disposable {
|
76 | private disposed;
|
77 | private disposable;
|
78 | set(disposable: Disposable): void;
|
79 | dispose(): void;
|
80 | }
|
81 |
|
\ | No newline at end of file |