@fluidframework/core-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.0
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/CHANGELOG.md +4 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +8 -3
- package/api-report/core-utils.api.md +19 -19
- package/dist/assert.d.ts +1 -1
- package/dist/assert.js +1 -1
- package/dist/assert.js.map +1 -1
- package/dist/core-utils-alpha.d.ts +19 -269
- package/dist/core-utils-beta.d.ts +19 -382
- package/dist/core-utils-public.d.ts +19 -382
- package/dist/core-utils-untrimmed.d.ts +19 -19
- package/dist/delay.d.ts +1 -1
- package/dist/delay.js +1 -1
- package/dist/delay.js.map +1 -1
- package/dist/heap.d.ts +4 -4
- package/dist/heap.js +2 -2
- package/dist/heap.js.map +1 -1
- package/dist/lazy.d.ts +2 -2
- package/dist/lazy.js +2 -2
- package/dist/lazy.js.map +1 -1
- package/dist/promiseCache.d.ts +3 -3
- package/dist/promiseCache.js +1 -1
- package/dist/promiseCache.js.map +1 -1
- package/dist/promises.d.ts +1 -1
- package/dist/promises.js +1 -1
- package/dist/promises.js.map +1 -1
- package/dist/timer.d.ts +6 -6
- package/dist/timer.js +3 -3
- package/dist/timer.js.map +1 -1
- package/dist/unreachable.d.ts +1 -1
- package/dist/unreachable.js +1 -1
- package/dist/unreachable.js.map +1 -1
- package/lib/assert.d.ts +1 -1
- package/lib/assert.js +6 -2
- package/lib/assert.js.map +1 -1
- package/lib/compare.js +5 -1
- package/lib/compare.js.map +1 -1
- package/lib/core-utils-alpha.d.ts +19 -269
- package/lib/core-utils-beta.d.ts +19 -382
- package/lib/core-utils-public.d.ts +19 -382
- package/lib/core-utils-untrimmed.d.ts +19 -19
- package/lib/delay.d.ts +1 -1
- package/lib/delay.js +6 -2
- package/lib/delay.js.map +1 -1
- package/lib/heap.d.ts +4 -4
- package/lib/heap.js +8 -4
- package/lib/heap.js.map +1 -1
- package/lib/index.js +25 -9
- package/lib/index.js.map +1 -1
- package/lib/lazy.d.ts +2 -2
- package/lib/lazy.js +9 -4
- package/lib/lazy.js.map +1 -1
- package/lib/promiseCache.d.ts +3 -3
- package/lib/promiseCache.js +6 -2
- package/lib/promiseCache.js.map +1 -1
- package/lib/promises.d.ts +1 -1
- package/lib/promises.js +6 -2
- package/lib/promises.js.map +1 -1
- package/lib/timer.d.ts +6 -6
- package/lib/timer.js +17 -11
- package/lib/timer.js.map +1 -1
- package/lib/unreachable.d.ts +1 -1
- package/lib/unreachable.js +6 -2
- package/lib/unreachable.js.map +1 -1
- package/package.json +9 -6
- package/src/assert.ts +1 -1
- package/src/delay.ts +1 -1
- package/src/heap.ts +4 -4
- package/src/lazy.ts +2 -2
- package/src/promiseCache.ts +3 -3
- package/src/promises.ts +1 -1
- package/src/timer.ts +6 -6
- package/src/unreachable.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: Add missing documentation and remove this rule override
|
|
7
|
+
"ae-undocumented": {
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
6
11
|
}
|
|
7
12
|
}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
// @
|
|
7
|
+
// @internal
|
|
8
8
|
export function assert(condition: boolean, message: string | number): asserts condition;
|
|
9
9
|
|
|
10
10
|
// @internal
|
|
11
11
|
export const compareArrays: <T>(left: readonly T[], right: readonly T[], comparator?: (leftItem: T, rightItem: T, index: number) => boolean) => boolean;
|
|
12
12
|
|
|
13
|
-
// @
|
|
13
|
+
// @alpha
|
|
14
14
|
export class Deferred<T> {
|
|
15
15
|
constructor();
|
|
16
16
|
get isCompleted(): boolean;
|
|
@@ -19,10 +19,10 @@ export class Deferred<T> {
|
|
|
19
19
|
resolve(value: T | PromiseLike<T>): void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
// @
|
|
22
|
+
// @internal
|
|
23
23
|
export const delay: (timeMs: number) => Promise<void>;
|
|
24
24
|
|
|
25
|
-
// @
|
|
25
|
+
// @internal
|
|
26
26
|
export class Heap<T> {
|
|
27
27
|
constructor(comp: IComparer<T>);
|
|
28
28
|
add(x: T): IHeapNode<T>;
|
|
@@ -35,13 +35,13 @@ export class Heap<T> {
|
|
|
35
35
|
update(node: IHeapNode<T>): void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// @
|
|
38
|
+
// @internal
|
|
39
39
|
export interface IComparer<T> {
|
|
40
40
|
compare(a: T, b: T): number;
|
|
41
41
|
min: T;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// @
|
|
44
|
+
// @internal
|
|
45
45
|
export interface IHeapNode<T> {
|
|
46
46
|
// (undocumented)
|
|
47
47
|
position: number;
|
|
@@ -49,32 +49,32 @@ export interface IHeapNode<T> {
|
|
|
49
49
|
value: T;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// @
|
|
52
|
+
// @internal
|
|
53
53
|
export interface IPromiseTimer extends ITimer {
|
|
54
54
|
start(): Promise<IPromiseTimerResult>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// @
|
|
57
|
+
// @internal (undocumented)
|
|
58
58
|
export interface IPromiseTimerResult {
|
|
59
59
|
// (undocumented)
|
|
60
60
|
timerResult: "timeout" | "cancel";
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// @
|
|
63
|
+
// @internal (undocumented)
|
|
64
64
|
export interface ITimer {
|
|
65
65
|
clear(): void;
|
|
66
66
|
readonly hasTimer: boolean;
|
|
67
67
|
start(): void;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// @
|
|
70
|
+
// @internal
|
|
71
71
|
export class Lazy<T> {
|
|
72
72
|
constructor(valueGenerator: () => T);
|
|
73
73
|
get evaluated(): boolean;
|
|
74
74
|
get value(): T;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// @
|
|
77
|
+
// @internal
|
|
78
78
|
export class LazyPromise<T> implements Promise<T> {
|
|
79
79
|
// (undocumented)
|
|
80
80
|
get [Symbol.toStringTag](): string;
|
|
@@ -87,10 +87,10 @@ export class LazyPromise<T> implements Promise<T> {
|
|
|
87
87
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
// @
|
|
90
|
+
// @internal
|
|
91
91
|
export const NumberComparer: IComparer<number>;
|
|
92
92
|
|
|
93
|
-
// @
|
|
93
|
+
// @alpha
|
|
94
94
|
export class PromiseCache<TKey, TResult> {
|
|
95
95
|
constructor({ expiry, removeOnError, }?: PromiseCacheOptions);
|
|
96
96
|
add(key: TKey, asyncFn: () => Promise<TResult>): boolean;
|
|
@@ -102,7 +102,7 @@ export class PromiseCache<TKey, TResult> {
|
|
|
102
102
|
remove(key: TKey): boolean;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// @
|
|
105
|
+
// @alpha
|
|
106
106
|
export type PromiseCacheExpiry = {
|
|
107
107
|
policy: "indefinite";
|
|
108
108
|
} | {
|
|
@@ -110,13 +110,13 @@ export type PromiseCacheExpiry = {
|
|
|
110
110
|
durationMs: number;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
// @
|
|
113
|
+
// @alpha
|
|
114
114
|
export interface PromiseCacheOptions {
|
|
115
115
|
expiry?: PromiseCacheExpiry;
|
|
116
116
|
removeOnError?: (error: any) => boolean;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
// @
|
|
119
|
+
// @internal
|
|
120
120
|
export class PromiseTimer implements IPromiseTimer {
|
|
121
121
|
constructor(defaultTimeout: number, defaultHandler: () => void);
|
|
122
122
|
// (undocumented)
|
|
@@ -127,10 +127,10 @@ export class PromiseTimer implements IPromiseTimer {
|
|
|
127
127
|
protected wrapHandler(handler: () => void): void;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// @
|
|
130
|
+
// @internal
|
|
131
131
|
export function setLongTimeout(timeoutFn: () => void, timeoutMs: number, setTimeoutIdFn?: (timeoutId: ReturnType<typeof setTimeout>) => void): ReturnType<typeof setTimeout>;
|
|
132
132
|
|
|
133
|
-
// @
|
|
133
|
+
// @internal
|
|
134
134
|
export class Timer implements ITimer {
|
|
135
135
|
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number);
|
|
136
136
|
clear(): void;
|
|
@@ -139,7 +139,7 @@ export class Timer implements ITimer {
|
|
|
139
139
|
start(ms?: number, handler?: () => void): void;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// @
|
|
142
|
+
// @internal
|
|
143
143
|
export function unreachableCase(_: never, message?: string): never;
|
|
144
144
|
|
|
145
145
|
// (No @packageDocumentation comment for this package)
|
package/dist/assert.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* A number should not be specified manually: use a string.
|
|
12
12
|
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
13
13
|
* use numbered error codes instead.
|
|
14
|
-
* @
|
|
14
|
+
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export declare function assert(condition: boolean, message: string | number): asserts condition;
|
|
17
17
|
//# sourceMappingURL=assert.d.ts.map
|
package/dist/assert.js
CHANGED
|
@@ -14,7 +14,7 @@ exports.assert = void 0;
|
|
|
14
14
|
* A number should not be specified manually: use a string.
|
|
15
15
|
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
16
16
|
* use numbered error codes instead.
|
|
17
|
-
* @
|
|
17
|
+
* @internal
|
|
18
18
|
*/
|
|
19
19
|
function assert(condition, message) {
|
|
20
20
|
if (!condition) {
|
package/dist/assert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,SAAkB,EAAE,OAAwB;IAClE,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CACd,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CACpF,CAAC;KACF;AACF,CAAC;AAND,wBAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A browser friendly assert library.\n * Use this instead of the 'assert' package, which has a big impact on bundle sizes.\n * @param condition - The condition that should be true, if the condition is false an error will be thrown.\n * Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.\n * @param message - The message to include in the error when the condition does not hold.\n * A number should not be specified manually: use a string.\n * Before a release, policy-check should be run, which will convert any asserts still using strings to\n * use numbered error codes instead.\n * @
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,SAAkB,EAAE,OAAwB;IAClE,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CACd,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CACpF,CAAC;KACF;AACF,CAAC;AAND,wBAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A browser friendly assert library.\n * Use this instead of the 'assert' package, which has a big impact on bundle sizes.\n * @param condition - The condition that should be true, if the condition is false an error will be thrown.\n * Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.\n * @param message - The message to include in the error when the condition does not hold.\n * A number should not be specified manually: use a string.\n * Before a release, policy-check should be run, which will convert any asserts still using strings to\n * use numbered error codes instead.\n * @internal\n */\nexport function assert(condition: boolean, message: string | number): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(\n\t\t\ttypeof message === \"number\" ? `0x${message.toString(16).padStart(3, \"0\")}` : message,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* A browser friendly assert library.
|
|
3
|
-
* Use this instead of the 'assert' package, which has a big impact on bundle sizes.
|
|
4
|
-
* @param condition - The condition that should be true, if the condition is false an error will be thrown.
|
|
5
|
-
* Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.
|
|
6
|
-
* @param message - The message to include in the error when the condition does not hold.
|
|
7
|
-
* A number should not be specified manually: use a string.
|
|
8
|
-
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
9
|
-
* use numbered error codes instead.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare function assert(condition: boolean, message: string | number): asserts condition;
|
|
1
|
+
/* Excluded from this release type: assert */
|
|
13
2
|
|
|
14
3
|
/* Excluded from this release type: compareArrays */
|
|
15
4
|
|
|
16
5
|
/**
|
|
17
6
|
* A deferred creates a promise and the ability to resolve or reject it
|
|
18
|
-
* @
|
|
7
|
+
* @alpha
|
|
19
8
|
*/
|
|
20
9
|
export declare class Deferred<T> {
|
|
21
10
|
private readonly p;
|
|
@@ -47,181 +36,30 @@ export declare class Deferred<T> {
|
|
|
47
36
|
reject(error: any): void;
|
|
48
37
|
}
|
|
49
38
|
|
|
50
|
-
|
|
51
|
-
* Returns a promise that resolves after `timeMs`.
|
|
52
|
-
* @param timeMs - Time in milliseconds to wait.
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
export declare const delay: (timeMs: number) => Promise<void>;
|
|
39
|
+
/* Excluded from this release type: delay */
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
* Ordered {@link https://en.wikipedia.org/wiki/Heap_(data_structure) | Heap} data structure implementation.
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
export declare class Heap<T> {
|
|
62
|
-
comp: IComparer<T>;
|
|
63
|
-
private L;
|
|
64
|
-
/**
|
|
65
|
-
* Creates an instance of `Heap` with comparer.
|
|
66
|
-
* @param comp - A comparer that specify how elements are ordered.
|
|
67
|
-
*/
|
|
68
|
-
constructor(comp: IComparer<T>);
|
|
69
|
-
/**
|
|
70
|
-
* Return the smallest element in the heap as determined by the order of the comparer
|
|
71
|
-
*
|
|
72
|
-
* @returns Heap node containing the smallest element
|
|
73
|
-
*/
|
|
74
|
-
peek(): IHeapNode<T>;
|
|
75
|
-
/**
|
|
76
|
-
* Get and remove the smallest element in the heap as determined by the order of the comparer
|
|
77
|
-
*
|
|
78
|
-
* @returns The smallest value in the heap
|
|
79
|
-
*/
|
|
80
|
-
get(): T;
|
|
81
|
-
/**
|
|
82
|
-
* Add a value to the heap
|
|
83
|
-
*
|
|
84
|
-
* @param x - value to add
|
|
85
|
-
* @returns The heap node that contains the value
|
|
86
|
-
*/
|
|
87
|
-
add(x: T): IHeapNode<T>;
|
|
88
|
-
/**
|
|
89
|
-
* Allows for the Heap to be updated after a node's value changes.
|
|
90
|
-
*/
|
|
91
|
-
update(node: IHeapNode<T>): void;
|
|
92
|
-
/**
|
|
93
|
-
* Removes the given node from the heap.
|
|
94
|
-
*
|
|
95
|
-
* @param node - The node to remove from the heap.
|
|
96
|
-
*/
|
|
97
|
-
remove(node: IHeapNode<T>): void;
|
|
98
|
-
/**
|
|
99
|
-
* Get the number of elements in the Heap.
|
|
100
|
-
*
|
|
101
|
-
* @returns The number of elements in the Heap.
|
|
102
|
-
*/
|
|
103
|
-
count(): number;
|
|
104
|
-
private fixup;
|
|
105
|
-
private isGreaterThanParent;
|
|
106
|
-
private fixdown;
|
|
107
|
-
private swap;
|
|
108
|
-
}
|
|
41
|
+
/* Excluded from this release type: Heap */
|
|
109
42
|
|
|
110
|
-
|
|
111
|
-
* Interface for a comparer.
|
|
112
|
-
* @public
|
|
113
|
-
*/
|
|
114
|
-
export declare interface IComparer<T> {
|
|
115
|
-
/**
|
|
116
|
-
* The minimum value of type T.
|
|
117
|
-
*/
|
|
118
|
-
min: T;
|
|
119
|
-
/**
|
|
120
|
-
* Compare the two value
|
|
121
|
-
*
|
|
122
|
-
* @returns 0 if the value is equal, negative number if a is smaller then b, positive number otherwise
|
|
123
|
-
*/
|
|
124
|
-
compare(a: T, b: T): number;
|
|
125
|
-
}
|
|
43
|
+
/* Excluded from this release type: IComparer */
|
|
126
44
|
|
|
127
|
-
|
|
128
|
-
* Interface to a node in {@link Heap}.
|
|
129
|
-
* @public
|
|
130
|
-
*/
|
|
131
|
-
export declare interface IHeapNode<T> {
|
|
132
|
-
value: T;
|
|
133
|
-
position: number;
|
|
134
|
-
}
|
|
45
|
+
/* Excluded from this release type: IHeapNode */
|
|
135
46
|
|
|
136
|
-
|
|
137
|
-
* Timer which offers a promise that fulfills when the timer
|
|
138
|
-
* completes.
|
|
139
|
-
* @public
|
|
140
|
-
*/
|
|
141
|
-
export declare interface IPromiseTimer extends ITimer {
|
|
142
|
-
/**
|
|
143
|
-
* Starts the timer and returns a promise that
|
|
144
|
-
* resolves when the timer times out or is canceled.
|
|
145
|
-
*/
|
|
146
|
-
start(): Promise<IPromiseTimerResult>;
|
|
147
|
-
}
|
|
47
|
+
/* Excluded from this release type: IPromiseTimer */
|
|
148
48
|
|
|
149
|
-
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
export declare interface IPromiseTimerResult {
|
|
153
|
-
timerResult: "timeout" | "cancel";
|
|
154
|
-
}
|
|
49
|
+
/* Excluded from this release type: IPromiseTimerResult */
|
|
155
50
|
|
|
156
|
-
|
|
157
|
-
* @public
|
|
158
|
-
*/
|
|
159
|
-
export declare interface ITimer {
|
|
160
|
-
/**
|
|
161
|
-
* True if timer is currently running
|
|
162
|
-
*/
|
|
163
|
-
readonly hasTimer: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Starts the timer
|
|
166
|
-
*/
|
|
167
|
-
start(): void;
|
|
168
|
-
/**
|
|
169
|
-
* Cancels the timer if already running
|
|
170
|
-
*/
|
|
171
|
-
clear(): void;
|
|
172
|
-
}
|
|
51
|
+
/* Excluded from this release type: ITimer */
|
|
173
52
|
|
|
174
|
-
|
|
175
|
-
* Helper class for lazy initialized values. Ensures the value is only generated once, and remain immutable.
|
|
176
|
-
* @public
|
|
177
|
-
*/
|
|
178
|
-
export declare class Lazy<T> {
|
|
179
|
-
private readonly valueGenerator;
|
|
180
|
-
private _value;
|
|
181
|
-
private _evaluated;
|
|
182
|
-
/**
|
|
183
|
-
* Instantiates an instance of Lazy<T>.
|
|
184
|
-
* @param valueGenerator - The function that will generate the value when value is accessed the first time.
|
|
185
|
-
*/
|
|
186
|
-
constructor(valueGenerator: () => T);
|
|
187
|
-
/**
|
|
188
|
-
* Return true if the value as been generated, otherwise false.
|
|
189
|
-
*/
|
|
190
|
-
get evaluated(): boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Get the value. If this is the first call the value will be generated.
|
|
193
|
-
*/
|
|
194
|
-
get value(): T;
|
|
195
|
-
}
|
|
53
|
+
/* Excluded from this release type: Lazy */
|
|
196
54
|
|
|
197
|
-
|
|
198
|
-
* A lazy evaluated promise. The execute function is delayed until
|
|
199
|
-
* the promise is used, e.g. await, then, catch ...
|
|
200
|
-
* The execute function is only called once.
|
|
201
|
-
* All calls are then proxied to the promise returned by the execute method.
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
export declare class LazyPromise<T> implements Promise<T> {
|
|
205
|
-
private readonly execute;
|
|
206
|
-
get [Symbol.toStringTag](): string;
|
|
207
|
-
private result;
|
|
208
|
-
constructor(execute: () => Promise<T>);
|
|
209
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
210
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
211
|
-
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
212
|
-
private getPromise;
|
|
213
|
-
}
|
|
55
|
+
/* Excluded from this release type: LazyPromise */
|
|
214
56
|
|
|
215
|
-
|
|
216
|
-
* A comparer for numbers.
|
|
217
|
-
* @public
|
|
218
|
-
*/
|
|
219
|
-
export declare const NumberComparer: IComparer<number>;
|
|
57
|
+
/* Excluded from this release type: NumberComparer */
|
|
220
58
|
|
|
221
59
|
/**
|
|
222
60
|
* A specialized cache for async work, allowing you to safely cache the promised result of some async work
|
|
223
61
|
* without fear of running it multiple times or losing track of errors.
|
|
224
|
-
* @
|
|
62
|
+
* @alpha
|
|
225
63
|
*/
|
|
226
64
|
export declare class PromiseCache<TKey, TResult> {
|
|
227
65
|
private readonly cache;
|
|
@@ -281,7 +119,7 @@ export declare class PromiseCache<TKey, TResult> {
|
|
|
281
119
|
* - indefinite: entries don't expire and must be explicitly removed
|
|
282
120
|
* - absolute: entries expire after the given duration in MS, even if accessed multiple times in the mean time
|
|
283
121
|
* - sliding: entries expire after the given duration in MS of inactivity (i.e. get resets the clock)
|
|
284
|
-
* @
|
|
122
|
+
* @alpha
|
|
285
123
|
*/
|
|
286
124
|
export declare type PromiseCacheExpiry = {
|
|
287
125
|
policy: "indefinite";
|
|
@@ -292,7 +130,7 @@ export declare type PromiseCacheExpiry = {
|
|
|
292
130
|
|
|
293
131
|
/**
|
|
294
132
|
* Options for configuring the {@link PromiseCache}
|
|
295
|
-
* @
|
|
133
|
+
* @alpha
|
|
296
134
|
*/
|
|
297
135
|
export declare interface PromiseCacheOptions {
|
|
298
136
|
/**
|
|
@@ -305,100 +143,12 @@ export declare interface PromiseCacheOptions {
|
|
|
305
143
|
removeOnError?: (error: any) => boolean;
|
|
306
144
|
}
|
|
307
145
|
|
|
308
|
-
|
|
309
|
-
* This class is a wrapper over setTimeout and clearTimeout which
|
|
310
|
-
* makes it simpler to keep track of recurring timeouts with the
|
|
311
|
-
* same handlers and timeouts, while also providing a promise that
|
|
312
|
-
* resolves when it times out.
|
|
313
|
-
* @public
|
|
314
|
-
*/
|
|
315
|
-
export declare class PromiseTimer implements IPromiseTimer {
|
|
316
|
-
private deferred?;
|
|
317
|
-
private readonly timer;
|
|
318
|
-
/**
|
|
319
|
-
* {@inheritDoc Timer.hasTimer}
|
|
320
|
-
*/
|
|
321
|
-
get hasTimer(): boolean;
|
|
322
|
-
constructor(defaultTimeout: number, defaultHandler: () => void);
|
|
323
|
-
/**
|
|
324
|
-
* {@inheritDoc IPromiseTimer.start}
|
|
325
|
-
*/
|
|
326
|
-
start(ms?: number, handler?: () => void): Promise<IPromiseTimerResult>;
|
|
327
|
-
clear(): void;
|
|
328
|
-
protected wrapHandler(handler: () => void): void;
|
|
329
|
-
}
|
|
146
|
+
/* Excluded from this release type: PromiseTimer */
|
|
330
147
|
|
|
331
|
-
|
|
332
|
-
* Sets timeouts like the setTimeout function allowing timeouts to exceed the setTimeout's max timeout limit.
|
|
333
|
-
* Timeouts may not be exactly accurate due to browser implementations and the OS.
|
|
334
|
-
* https://stackoverflow.com/questions/21097421/what-is-the-reason-javascript-settimeout-is-so-inaccurate
|
|
335
|
-
* @param timeoutFn - Executed when the timeout expires
|
|
336
|
-
* @param timeoutMs - Duration of the timeout in milliseconds
|
|
337
|
-
* @param setTimeoutIdFn - Executed to update the timeout if multiple timeouts are required when
|
|
338
|
-
* timeoutMs greater than maxTimeout
|
|
339
|
-
* @returns The initial timeout
|
|
340
|
-
* @public
|
|
341
|
-
*/
|
|
342
|
-
export declare function setLongTimeout(timeoutFn: () => void, timeoutMs: number, setTimeoutIdFn?: (timeoutId: ReturnType<typeof setTimeout>) => void): ReturnType<typeof setTimeout>;
|
|
148
|
+
/* Excluded from this release type: setLongTimeout */
|
|
343
149
|
|
|
344
|
-
|
|
345
|
-
* This class is a thin wrapper over setTimeout and clearTimeout which
|
|
346
|
-
* makes it simpler to keep track of recurring timeouts with the same
|
|
347
|
-
* or similar handlers and timeouts. This class supports long timeouts
|
|
348
|
-
* or timeouts exceeding (2^31)-1 ms or approximately 24.8 days.
|
|
349
|
-
* @public
|
|
350
|
-
*/
|
|
351
|
-
export declare class Timer implements ITimer {
|
|
352
|
-
private readonly defaultTimeout;
|
|
353
|
-
private readonly defaultHandler;
|
|
354
|
-
private readonly getCurrentTick;
|
|
355
|
-
/**
|
|
356
|
-
* Returns true if the timer is running.
|
|
357
|
-
*/
|
|
358
|
-
get hasTimer(): boolean;
|
|
359
|
-
private runningState;
|
|
360
|
-
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number);
|
|
361
|
-
/**
|
|
362
|
-
* Calls setTimeout and tracks the resulting timeout.
|
|
363
|
-
* @param ms - overrides default timeout in ms
|
|
364
|
-
* @param handler - overrides default handler
|
|
365
|
-
*/
|
|
366
|
-
start(ms?: number, handler?: () => void): void;
|
|
367
|
-
/**
|
|
368
|
-
* Calls clearTimeout on the underlying timeout if running.
|
|
369
|
-
*/
|
|
370
|
-
clear(): void;
|
|
371
|
-
/**
|
|
372
|
-
* Restarts the timer with the new handler and duration.
|
|
373
|
-
* If a new handler is passed, the original handler may
|
|
374
|
-
* never execute.
|
|
375
|
-
* This is a potentially more efficient way to clear and start
|
|
376
|
-
* a new timer.
|
|
377
|
-
* @param ms - overrides previous or default timeout in ms
|
|
378
|
-
* @param handler - overrides previous or default handler
|
|
379
|
-
*/
|
|
380
|
-
restart(ms?: number, handler?: () => void): void;
|
|
381
|
-
private startCore;
|
|
382
|
-
private handler;
|
|
383
|
-
private calculateRemainingTime;
|
|
384
|
-
}
|
|
150
|
+
/* Excluded from this release type: Timer */
|
|
385
151
|
|
|
386
|
-
|
|
387
|
-
* This function can be used to assert at compile time that a given value has type never.
|
|
388
|
-
* One common usage is in the default case of a switch block,
|
|
389
|
-
* to ensure that all cases are explicitly handled.
|
|
390
|
-
*
|
|
391
|
-
* Example:
|
|
392
|
-
* ```typescript
|
|
393
|
-
* const bool: true | false = ...;
|
|
394
|
-
* switch(bool) {
|
|
395
|
-
* case true: {...}
|
|
396
|
-
* case false: {...}
|
|
397
|
-
* default: unreachableCase(bool);
|
|
398
|
-
* }
|
|
399
|
-
* ```
|
|
400
|
-
* @public
|
|
401
|
-
*/
|
|
402
|
-
export declare function unreachableCase(_: never, message?: string): never;
|
|
152
|
+
/* Excluded from this release type: unreachableCase */
|
|
403
153
|
|
|
404
154
|
export { }
|