@fbltd/async 1.0.9 → 1.0.11
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/README.md +16 -11
- package/dist/bin/constants.js +4 -0
- package/dist/bin/{utils/delay.js → delay.js} +3 -3
- package/dist/bin/dependency-stream/contracts.js +2 -0
- package/dist/bin/{core → dependency-stream}/dependency-stream.js +19 -11
- package/dist/bin/{core → dependency-stream}/index.js +2 -0
- package/dist/bin/{utils → dependency-stream/integrations}/index.js +1 -1
- package/dist/bin/{react → dependency-stream/integrations/react}/src/use-stream.js +2 -2
- package/dist/bin/dependency-stream/utils/index.js +7 -0
- package/dist/bin/dependency-stream/utils/once.js +19 -0
- package/dist/bin/dependency-stream/utils/race.stream.js +28 -0
- package/dist/bin/index.js +4 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/delay.d.ts +2 -0
- package/dist/types/dependency-stream/contracts.d.ts +10 -0
- package/dist/types/dependency-stream/dependency-stream.d.ts +26 -0
- package/dist/types/{core → dependency-stream}/index.d.ts +2 -0
- package/dist/types/dependency-stream/integrations/index.d.ts +1 -0
- package/dist/types/{react → dependency-stream/integrations/react}/src/use-stream.d.ts +1 -1
- package/dist/types/dependency-stream/utils/index.d.ts +2 -0
- package/dist/types/dependency-stream/utils/once.d.ts +9 -0
- package/dist/types/dependency-stream/utils/race.stream.d.ts +12 -0
- package/dist/types/index.d.ts +4 -3
- package/package.json +3 -2
- package/dist/bin/core/utils.js +0 -45
- package/dist/types/core/dependency-stream.d.ts +0 -30
- package/dist/types/core/utils.d.ts +0 -35
- package/dist/types/utils/delay.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -1
- /package/dist/bin/{react → dependency-stream/integrations/react}/index.js +0 -0
- /package/dist/bin/{react → dependency-stream/integrations/react}/src/index.js +0 -0
- /package/dist/bin/{utils/get-promise.js → get-promise.js} +0 -0
- /package/dist/types/{react → dependency-stream/integrations/react}/index.d.ts +0 -0
- /package/dist/types/{react → dependency-stream/integrations/react}/src/index.d.ts +0 -0
- /package/dist/types/{utils/get-promise.d.ts → get-promise.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Async tools
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
### delay
|
|
4
6
|
delay is a function that can be executed synchronous or asynchronous.
|
|
5
7
|
The behaviour depends on passed arguments:
|
|
6
8
|
```typescript
|
|
@@ -8,10 +10,10 @@ The behaviour depends on passed arguments:
|
|
|
8
10
|
await delay(number);
|
|
9
11
|
|
|
10
12
|
// Returns nothing - synchrounous running in a blocking manner;
|
|
11
|
-
delay(number,
|
|
13
|
+
delay(number, 'sync');
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
### getPromise
|
|
15
17
|
getPromise is a function that creates and returns promise, its fulfillment functions
|
|
16
18
|
and status flags.
|
|
17
19
|
Returned type is:
|
|
@@ -27,8 +29,8 @@ type IPromiseConfiguration<T> = {
|
|
|
27
29
|
There is no any management of passed data for resolving.
|
|
28
30
|
Returned promise is usual ES promise so it is impossible to fulfill promise twice.
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
### DependencyStream
|
|
33
|
+
#### core
|
|
32
34
|
Implementation of reactive model leveraging native JavaScript async features like
|
|
33
35
|
Promises, (async) iterators and generators.
|
|
34
36
|
The version is 0.0.x so keep it in mind
|
|
@@ -37,7 +39,7 @@ The version is 0.0.x so keep it in mind
|
|
|
37
39
|
const counter = new DependencyStream<number>(0);
|
|
38
40
|
|
|
39
41
|
async function onCounterChange() {
|
|
40
|
-
for await (let value of counter
|
|
42
|
+
for await (let value of counter) {
|
|
41
43
|
// do whatever you want
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -54,13 +56,13 @@ setInterval(() => {
|
|
|
54
56
|
// differs from the previous one.
|
|
55
57
|
// Subsequent value updates are collected and processed together
|
|
56
58
|
// during the next microtask execution phase of the event loop.
|
|
57
|
-
counter.
|
|
59
|
+
counter.value = i++;
|
|
58
60
|
}
|
|
59
61
|
}, 1000)
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
#### Framework integrations
|
|
65
|
+
##### React
|
|
64
66
|
Of course, there is a React integration via useStream hook:
|
|
65
67
|
|
|
66
68
|
```typescript jsx
|
|
@@ -99,5 +101,8 @@ export const Counter: React.FC<ITest> = React.memo(({
|
|
|
99
101
|
})
|
|
100
102
|
```
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
Now this package is CommonJS module but should be an ESM.
|
|
104
|
+
### Disclaimer
|
|
105
|
+
Now this package is CommonJS module but should be an ESM.
|
|
106
|
+
|
|
107
|
+
## Installation
|
|
108
|
+
Just type ```npm i @fbltd/async```
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delay = delay;
|
|
4
4
|
const get_promise_1 = require("./get-promise");
|
|
5
|
-
function delay(ms = 0,
|
|
5
|
+
function delay(ms = 0, syncKey) {
|
|
6
6
|
ms = Math.max(ms, 0);
|
|
7
|
-
return delay.methods[typeof
|
|
7
|
+
return delay.methods[typeof syncKey](ms);
|
|
8
8
|
}
|
|
9
9
|
Object.defineProperty(delay, 'methods', {
|
|
10
10
|
value: {
|
|
11
|
-
|
|
11
|
+
string: (ms) => {
|
|
12
12
|
const start = performance.now();
|
|
13
13
|
while (true) {
|
|
14
14
|
if (performance.now() - start >= ms) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DependencyStream = void 0;
|
|
4
|
-
const
|
|
4
|
+
const get_promise_1 = require("../get-promise");
|
|
5
5
|
function baseComparer(prev, cur) {
|
|
6
6
|
return prev === cur;
|
|
7
7
|
}
|
|
8
8
|
class DependencyStream {
|
|
9
9
|
_value;
|
|
10
10
|
reactionPromise;
|
|
11
|
-
abortPromise = (0,
|
|
11
|
+
abortPromise = (0, get_promise_1.getPromise)();
|
|
12
12
|
config;
|
|
13
13
|
constructor(_value, config = {}) {
|
|
14
14
|
this._value = _value;
|
|
@@ -34,30 +34,38 @@ class DependencyStream {
|
|
|
34
34
|
get value() {
|
|
35
35
|
return this._value;
|
|
36
36
|
}
|
|
37
|
-
[Symbol.asyncIterator]() {
|
|
37
|
+
[Symbol.asyncIterator](thisStreamConfig = {}) {
|
|
38
38
|
const totalDispose = this.abortPromise;
|
|
39
|
-
const
|
|
40
|
-
const externalPromises = [totalDispose.promise, selfDispose.promise];
|
|
39
|
+
const externalPromises = [totalDispose.promise];
|
|
41
40
|
let firstPromise;
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const withReactionOnSubscribe = this.config.withReactionOnSubscribe || thisStreamConfig.withReactionOnSubscribe;
|
|
42
|
+
if (withReactionOnSubscribe) {
|
|
43
|
+
firstPromise = (0, get_promise_1.getPromise)();
|
|
44
44
|
firstPromise.resolve(this.value);
|
|
45
45
|
externalPromises.push(firstPromise.promise);
|
|
46
46
|
}
|
|
47
|
+
if (thisStreamConfig.externalDispose) {
|
|
48
|
+
externalPromises.push(thisStreamConfig.externalDispose.promise);
|
|
49
|
+
}
|
|
50
|
+
let isDisposed = false;
|
|
47
51
|
const owner = this;
|
|
48
52
|
return {
|
|
49
53
|
owner,
|
|
50
|
-
dispose:
|
|
54
|
+
dispose: owner.dispose.bind(owner),
|
|
55
|
+
get isDisposed() {
|
|
56
|
+
return isDisposed;
|
|
57
|
+
},
|
|
51
58
|
next: async () => {
|
|
52
59
|
if (!this.reactionPromise) {
|
|
53
|
-
this.reactionPromise = (0,
|
|
60
|
+
this.reactionPromise = (0, get_promise_1.getPromise)();
|
|
54
61
|
this._set(this._value);
|
|
55
62
|
}
|
|
56
63
|
await Promise.race([
|
|
57
64
|
...externalPromises,
|
|
58
65
|
this.reactionPromise.promise,
|
|
59
66
|
]);
|
|
60
|
-
if (totalDispose.isFulfilled ||
|
|
67
|
+
if (totalDispose.isFulfilled || thisStreamConfig.externalDispose?.isFulfilled) {
|
|
68
|
+
isDisposed = true;
|
|
61
69
|
return { done: true };
|
|
62
70
|
}
|
|
63
71
|
if (firstPromise) {
|
|
@@ -75,7 +83,7 @@ class DependencyStream {
|
|
|
75
83
|
}
|
|
76
84
|
dispose() {
|
|
77
85
|
this.abortPromise.resolve();
|
|
78
|
-
this.abortPromise = (0,
|
|
86
|
+
this.abortPromise = (0, get_promise_1.getPromise)();
|
|
79
87
|
this.reactionPromise = undefined;
|
|
80
88
|
}
|
|
81
89
|
}
|
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./dependency-stream"), exports);
|
|
18
18
|
__exportStar(require("./utils"), exports);
|
|
19
|
+
__exportStar(require("./integrations"), exports);
|
|
20
|
+
__exportStar(require("./contracts"), exports);
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./react"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useStream = useStream;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../../../index");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
class StreamController {
|
|
7
7
|
setValue;
|
|
@@ -12,7 +12,7 @@ class StreamController {
|
|
|
12
12
|
this.init();
|
|
13
13
|
}
|
|
14
14
|
async init() {
|
|
15
|
-
this.iterator = (0,
|
|
15
|
+
this.iterator = (0, index_1.raceStream)(...this.streams);
|
|
16
16
|
for await (let chunk of this.iterator) {
|
|
17
17
|
console.log(chunk);
|
|
18
18
|
this.setValue?.(chunk);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.raceStream = exports.once = void 0;
|
|
4
|
+
var once_1 = require("./once");
|
|
5
|
+
Object.defineProperty(exports, "once", { enumerable: true, get: function () { return once_1.once; } });
|
|
6
|
+
var race_stream_1 = require("./race.stream");
|
|
7
|
+
Object.defineProperty(exports, "raceStream", { enumerable: true, get: function () { return race_stream_1.raceStream; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.once = once;
|
|
4
|
+
function once(dep) {
|
|
5
|
+
let isIterationWas = false;
|
|
6
|
+
const iterator = dep[Symbol.asyncIterator]();
|
|
7
|
+
return {
|
|
8
|
+
[Symbol.asyncIterator]() {
|
|
9
|
+
return {
|
|
10
|
+
next: async () => {
|
|
11
|
+
if (isIterationWas)
|
|
12
|
+
return { done: true };
|
|
13
|
+
return iterator.next();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
dispose: iterator.dispose,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.raceStream = raceStream;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const get_promise_1 = require("../../get-promise");
|
|
6
|
+
function raceStream(...deps) {
|
|
7
|
+
let selfDisposePromise = (0, get_promise_1.getPromise)();
|
|
8
|
+
let isDisposed = false;
|
|
9
|
+
const streams = deps.map((dep) => dep[constants_1.symAI]({
|
|
10
|
+
externalDispose: selfDisposePromise
|
|
11
|
+
}));
|
|
12
|
+
return {
|
|
13
|
+
dispose: () => selfDisposePromise.resolve({ done: true, value: void 0 }),
|
|
14
|
+
get isDisposed() {
|
|
15
|
+
return isDisposed;
|
|
16
|
+
},
|
|
17
|
+
[constants_1.symAI]() {
|
|
18
|
+
return {
|
|
19
|
+
next: async () => {
|
|
20
|
+
const res = await Promise.race([selfDisposePromise.promise, ...streams.map(s => s.next())]);
|
|
21
|
+
if (res.done)
|
|
22
|
+
return res;
|
|
23
|
+
return { done: false, value: streams.map(s => s.owner.value) };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
package/dist/bin/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./react"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./dependency-stream"), exports);
|
|
18
|
+
__exportStar(require("./dependency-stream/integrations/react"), exports);
|
|
19
|
+
__exportStar(require("./delay"), exports);
|
|
20
|
+
__exportStar(require("./get-promise"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const symAI: typeof Symbol.asyncIterator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IIteratorOwner<TValue = any> {
|
|
2
|
+
value: TValue;
|
|
3
|
+
dispose(): void;
|
|
4
|
+
}
|
|
5
|
+
export interface IStreamIterator<TValue = any> {
|
|
6
|
+
owner: IIteratorOwner<TValue>;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
readonly isDisposed: boolean;
|
|
9
|
+
next(): Promise<IteratorResult<TValue, void>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IPromiseConfiguration } from "../get-promise";
|
|
2
|
+
import { IIteratorOwner, IStreamIterator } from "./contracts";
|
|
3
|
+
interface IIsEquals<T> {
|
|
4
|
+
(prev: T, cur: T): boolean;
|
|
5
|
+
}
|
|
6
|
+
type IAllStreamConfig<T> = {
|
|
7
|
+
withCustomEquality: IIsEquals<T>;
|
|
8
|
+
withReactionOnSubscribe: boolean;
|
|
9
|
+
};
|
|
10
|
+
type IThisStreamConfig = Partial<{
|
|
11
|
+
withReactionOnSubscribe: boolean;
|
|
12
|
+
externalDispose: IPromiseConfiguration<any>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class DependencyStream<T = any> implements IIteratorOwner<T> {
|
|
15
|
+
private _value;
|
|
16
|
+
private reactionPromise;
|
|
17
|
+
private abortPromise;
|
|
18
|
+
private config;
|
|
19
|
+
constructor(_value: T, config?: Partial<IAllStreamConfig<T>>);
|
|
20
|
+
private _set;
|
|
21
|
+
set value(v: T);
|
|
22
|
+
get value(): T;
|
|
23
|
+
[Symbol.asyncIterator](this: DependencyStream<T>, thisStreamConfig?: IThisStreamConfig): IStreamIterator<T>;
|
|
24
|
+
dispose(this: DependencyStream<T>): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DependencyStream } from "../dependency-stream";
|
|
2
|
+
export declare function once(dep: DependencyStream): {
|
|
3
|
+
[Symbol.asyncIterator](): {
|
|
4
|
+
next: () => Promise<IteratorYieldResult<any> | IteratorReturnResult<void> | {
|
|
5
|
+
done: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
dispose: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DependencyStream } from "../dependency-stream";
|
|
2
|
+
import { symAI } from "../../constants";
|
|
3
|
+
export declare function raceStream<TArray extends DependencyStream[]>(...deps: NoInfer<TArray>): {
|
|
4
|
+
dispose: () => void;
|
|
5
|
+
readonly isDisposed: boolean;
|
|
6
|
+
[Symbol.asyncIterator](): {
|
|
7
|
+
next: () => Promise<IteratorReturnResult<void> | {
|
|
8
|
+
done: boolean;
|
|
9
|
+
value: any[];
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './react';
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './dependency-stream';
|
|
2
|
+
export * from './dependency-stream/integrations/react';
|
|
3
|
+
export * from './delay';
|
|
4
|
+
export * from './get-promise';
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fbltd/async",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Miscellaneous async utils",
|
|
5
|
+
"homepage": "https://github.com/GlennMiller1991/async",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"Reactivity",
|
|
7
8
|
"State Management",
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"clearDist": "rm dist -rf || true",
|
|
23
24
|
"clearModules": "rm node_modules -rf || true",
|
|
24
25
|
"clearAll": "npm run clearDist && npm run clearModules",
|
|
25
|
-
"build": "cd src/react && npm run build && cd
|
|
26
|
+
"build": "cd src/dependency-stream/integrations/react && npm run build && cd ../../../../ && npm run clearAll && npm i && mkdir dist && tsc",
|
|
26
27
|
"test": "jest --config=./__tests__/jest.config.js",
|
|
27
28
|
"postVersionCommit": "git commit -m='post version commit' || true",
|
|
28
29
|
"postVersionPush": "git push || true",
|
package/dist/bin/core/utils.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stream = stream;
|
|
4
|
-
exports.once = once;
|
|
5
|
-
exports.anyStream = anyStream;
|
|
6
|
-
function stream(dep) {
|
|
7
|
-
return dep[Symbol.asyncIterator]();
|
|
8
|
-
}
|
|
9
|
-
function once(dep) {
|
|
10
|
-
let isIterationWas = false;
|
|
11
|
-
const iterator = dep[Symbol.asyncIterator]();
|
|
12
|
-
return {
|
|
13
|
-
[Symbol.asyncIterator]() {
|
|
14
|
-
return {
|
|
15
|
-
next: async () => {
|
|
16
|
-
if (isIterationWas)
|
|
17
|
-
return { done: true };
|
|
18
|
-
return iterator.next();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
dispose: iterator.dispose,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function anyStream(...deps) {
|
|
26
|
-
const streams = deps.map((dep) => stream(dep));
|
|
27
|
-
let disposed = false;
|
|
28
|
-
return {
|
|
29
|
-
dispose: () => {
|
|
30
|
-
streams.map(s => s.dispose());
|
|
31
|
-
disposed = true;
|
|
32
|
-
},
|
|
33
|
-
[Symbol.asyncIterator]() {
|
|
34
|
-
return {
|
|
35
|
-
next: async () => {
|
|
36
|
-
await Promise.race(streams.map(s => s.next()));
|
|
37
|
-
if (disposed) {
|
|
38
|
-
return { done: true };
|
|
39
|
-
}
|
|
40
|
-
return { done: false, value: streams.map(s => s.owner.value) };
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface IIsEquals<T> {
|
|
2
|
-
(prev: T, cur: T): boolean;
|
|
3
|
-
}
|
|
4
|
-
type IDependencyStreamConfig<T> = {
|
|
5
|
-
withCustomEquality: IIsEquals<T>;
|
|
6
|
-
withReactionOnSubscribe: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class DependencyStream<T = any> {
|
|
9
|
-
private _value;
|
|
10
|
-
private reactionPromise;
|
|
11
|
-
private abortPromise;
|
|
12
|
-
private config;
|
|
13
|
-
constructor(_value: T, config?: Partial<IDependencyStreamConfig<T>>);
|
|
14
|
-
private _set;
|
|
15
|
-
set value(v: T);
|
|
16
|
-
get value(): T;
|
|
17
|
-
[Symbol.asyncIterator](this: DependencyStream<T>): {
|
|
18
|
-
owner: DependencyStream<T>;
|
|
19
|
-
dispose: () => void;
|
|
20
|
-
next: () => Promise<{
|
|
21
|
-
done: boolean;
|
|
22
|
-
readonly value?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
done: boolean;
|
|
25
|
-
readonly value: T;
|
|
26
|
-
}>;
|
|
27
|
-
};
|
|
28
|
-
dispose(this: DependencyStream<T>): void;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { DependencyStream } from "./dependency-stream";
|
|
2
|
-
export declare function stream(dep: DependencyStream): {
|
|
3
|
-
owner: DependencyStream<any>;
|
|
4
|
-
dispose: () => void;
|
|
5
|
-
next: () => Promise<{
|
|
6
|
-
done: boolean;
|
|
7
|
-
readonly value?: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
done: boolean;
|
|
10
|
-
readonly value: any;
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
|
-
export declare function once(dep: DependencyStream): {
|
|
14
|
-
[Symbol.asyncIterator](): {
|
|
15
|
-
next: () => Promise<{
|
|
16
|
-
done: boolean;
|
|
17
|
-
readonly value: any;
|
|
18
|
-
} | {
|
|
19
|
-
done: boolean;
|
|
20
|
-
}>;
|
|
21
|
-
};
|
|
22
|
-
dispose: () => void;
|
|
23
|
-
};
|
|
24
|
-
export declare function anyStream(...deps: DependencyStream[]): {
|
|
25
|
-
dispose: () => void;
|
|
26
|
-
[Symbol.asyncIterator](): {
|
|
27
|
-
next: () => Promise<{
|
|
28
|
-
done: boolean;
|
|
29
|
-
readonly value?: undefined;
|
|
30
|
-
} | {
|
|
31
|
-
done: boolean;
|
|
32
|
-
value: any[];
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './get-promise';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|