1 | import { Disposable, DisposableCollection } from './disposable';
|
2 | import { Emitter, Event } from './event';
|
3 | import { MaybePromise } from './types';
|
4 | export interface Reference<T> extends Disposable {
|
5 | readonly object: T;
|
6 | }
|
7 | export declare abstract class AbstractReferenceCollection<K, V extends Disposable> implements Disposable {
|
8 | protected readonly _keys: Map<string, K>;
|
9 | protected readonly _values: Map<string, V>;
|
10 | protected readonly references: Map<string, DisposableCollection>;
|
11 | protected readonly onDidCreateEmitter: Emitter<V>;
|
12 | readonly onDidCreate: Event<V>;
|
13 | protected readonly onWillDisposeEmitter: Emitter<V>;
|
14 | readonly onWillDispose: Event<V>;
|
15 | protected readonly toDispose: DisposableCollection;
|
16 | constructor();
|
17 | dispose(): void;
|
18 | clear(): void;
|
19 | has(args: K): boolean;
|
20 | keys(): K[];
|
21 | values(): V[];
|
22 | get(args: K): V | undefined;
|
23 | abstract acquire(args: K): MaybePromise<Reference<V>>;
|
24 | protected doAcquire(key: string, object: V): Reference<V>;
|
25 | protected toKey(args: K): string;
|
26 | protected createReferences(key: string, value: V): DisposableCollection;
|
27 | }
|
28 | export declare class ReferenceCollection<K, V extends Disposable> extends AbstractReferenceCollection<K, V> {
|
29 | protected readonly factory: (key: K) => MaybePromise<V>;
|
30 | constructor(factory: (key: K) => MaybePromise<V>);
|
31 | acquire(args: K): Promise<Reference<V>>;
|
32 | protected readonly pendingValues: Map<string, MaybePromise<V>>;
|
33 | protected getOrCreateValue(key: string, args: K): Promise<V>;
|
34 | }
|
35 | export declare class SyncReferenceCollection<K, V extends Disposable> extends AbstractReferenceCollection<K, V> {
|
36 | protected readonly factory: (key: K) => V;
|
37 | constructor(factory: (key: K) => V);
|
38 | acquire(args: K): Reference<V>;
|
39 | protected getOrCreateValue(key: string, args: K): V;
|
40 | }
|
41 | //# sourceMappingURL=reference.d.ts.map |
\ | No newline at end of file |