@stompbox/tape-delay 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +45 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,55 @@ type Entry<T> = [EntryDescription<T>, EntryDescription<T>, EntryDescription<T>]
|
|
|
13
13
|
export type Entries = Record<string, Entry<unknown>>;
|
|
14
14
|
export type EnvironmentDetector = () => Environment;
|
|
15
15
|
type EntryType<T> = T extends Entry<infer G> ? PublicFields<G> : never;
|
|
16
|
+
/**
|
|
17
|
+
* Lifetime scopes.
|
|
18
|
+
*/
|
|
16
19
|
export declare const Scope: {
|
|
20
|
+
/**
|
|
21
|
+
* Singleton scope.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { Scope } from '@stompbox/tape-delay'
|
|
26
|
+
*
|
|
27
|
+
* const entries = { A: Scope.Singleton(A) }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
17
30
|
Singleton: <T>(EntryClass: ClassEntry<T>) => EntryDescription<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Transient scope (used by default).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { Scope } from '@stompbox/tape-delay'
|
|
37
|
+
*
|
|
38
|
+
* const entries = { A: Scope.Transient(A) }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
18
41
|
Transient: <T>(EntryClass: ClassEntry<T>) => EntryDescription<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Request scope.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { Scope } from '@stompbox/tape-delay'
|
|
48
|
+
*
|
|
49
|
+
* const entries = { A: Scope.Request(A) }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
19
52
|
Request: <T>(EntryClass: ClassEntry<T>) => EntryDescription<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Constant value scope.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { Scope } from '@stompbox/tape-delay'
|
|
59
|
+
*
|
|
60
|
+
* const instance = new A()
|
|
61
|
+
*
|
|
62
|
+
* const entries = { A: Scope.ConstantValue(instance) }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
20
65
|
ConstantValue: <T>(value: T) => ConstantValueEntry<T>;
|
|
21
66
|
};
|
|
22
67
|
/**
|