@thi.ng/rstream 7.2.31 → 7.2.33
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 +1 -1
- package/README.md +1 -1
- package/atom.d.ts +8 -7
- package/atom.js +8 -7
- package/merge.d.ts +7 -5
- package/merge.js +7 -5
- package/object.d.ts +3 -2
- package/package.json +11 -11
- package/pubsub.d.ts +4 -3
- package/pubsub.js +4 -3
- package/stream.d.ts +19 -20
- package/subscription.d.ts +28 -28
- package/subscription.js +24 -24
- package/sync.d.ts +3 -3
- package/sync.js +3 -3
- package/tunnel.d.ts +3 -3
- package/view.d.ts +16 -15
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ This project is part of the
|
|
|
45
45
|
|
|
46
46
|
## About
|
|
47
47
|
|
|
48
|
-
Reactive streams & subscription primitives for constructing dataflow graphs / pipelines
|
|
48
|
+
Reactive streams & subscription primitives for constructing dataflow graphs / pipelines.
|
|
49
49
|
|
|
50
50
|
This library provides & uses three key building blocks for reactive
|
|
51
51
|
programming:
|
package/atom.d.ts
CHANGED
|
@@ -18,15 +18,16 @@ export interface FromAtomOpts<T> extends CommonOpts {
|
|
|
18
18
|
changed: Predicate2<T>;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Yields {@link Stream} of value changes in given
|
|
22
|
-
*
|
|
21
|
+
* Yields {@link Stream} of value changes in given [Atom-like state
|
|
22
|
+
* container](https://thi.ng/atom).
|
|
23
23
|
*
|
|
24
24
|
* @remarks
|
|
25
|
-
* Attaches a
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* [Attaches a
|
|
26
|
+
* watch](https://docs.thi.ng/umbrella/api/interfaces/IWatch.html#addWatch) to
|
|
27
|
+
* the atom and checks for value changes with given `changed` predicate (`!==`
|
|
28
|
+
* by default). If the predicate returns truthy result, the new value is emitted
|
|
29
|
+
* on the stream. If `emitFirst` is true (default), also emits atom's current
|
|
30
|
+
* value when first subscriber attaches to stream.
|
|
30
31
|
*
|
|
31
32
|
* Also see {@link fromView}, {@link fromViewUnsafe}
|
|
32
33
|
*
|
package/atom.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { __optsWithID } from "./idgen.js";
|
|
2
2
|
import { stream } from "./stream.js";
|
|
3
3
|
/**
|
|
4
|
-
* Yields {@link Stream} of value changes in given
|
|
5
|
-
*
|
|
4
|
+
* Yields {@link Stream} of value changes in given [Atom-like state
|
|
5
|
+
* container](https://thi.ng/atom).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* Attaches a
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* [Attaches a
|
|
9
|
+
* watch](https://docs.thi.ng/umbrella/api/interfaces/IWatch.html#addWatch) to
|
|
10
|
+
* the atom and checks for value changes with given `changed` predicate (`!==`
|
|
11
|
+
* by default). If the predicate returns truthy result, the new value is emitted
|
|
12
|
+
* on the stream. If `emitFirst` is true (default), also emits atom's current
|
|
13
|
+
* value when first subscriber attaches to stream.
|
|
13
14
|
*
|
|
14
15
|
* Also see {@link fromView}, {@link fromViewUnsafe}
|
|
15
16
|
*
|
package/merge.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export interface StreamMergeOpts<A, B> extends TransformableOpts<A, B> {
|
|
|
11
11
|
* multiple inputs and passing received values on to any subscribers.
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
|
-
* Input streams can be added and removed dynamically. By default,
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Input streams can be added and removed dynamically. By default, `StreamMerge`
|
|
15
|
+
* calls {@link ISubscriber.done} when the last active input is done, but this
|
|
16
|
+
* behavior can be overridden via the provided
|
|
17
17
|
* {@link StreamMergeOpts | options}.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
@@ -38,8 +38,10 @@ export interface StreamMergeOpts<A, B> extends TransformableOpts<A, B> {
|
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
|
-
* Use the
|
|
42
|
-
*
|
|
41
|
+
* Use the
|
|
42
|
+
* [`labeled()`](https://docs.thi.ng/umbrella/transducers/functions/labeled.html)
|
|
43
|
+
* transducer for each input to create a stream of labeled values and
|
|
44
|
+
* track their provenance:
|
|
43
45
|
*
|
|
44
46
|
* @example
|
|
45
47
|
* ```ts
|
package/merge.js
CHANGED
|
@@ -8,9 +8,9 @@ import { Subscription } from "./subscription.js";
|
|
|
8
8
|
* multiple inputs and passing received values on to any subscribers.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
* Input streams can be added and removed dynamically. By default,
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Input streams can be added and removed dynamically. By default, `StreamMerge`
|
|
12
|
+
* calls {@link ISubscriber.done} when the last active input is done, but this
|
|
13
|
+
* behavior can be overridden via the provided
|
|
14
14
|
* {@link StreamMergeOpts | options}.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
@@ -35,8 +35,10 @@ import { Subscription } from "./subscription.js";
|
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
|
-
* Use the
|
|
39
|
-
*
|
|
38
|
+
* Use the
|
|
39
|
+
* [`labeled()`](https://docs.thi.ng/umbrella/transducers/functions/labeled.html)
|
|
40
|
+
* transducer for each input to create a stream of labeled values and
|
|
41
|
+
* track their provenance:
|
|
40
42
|
*
|
|
41
43
|
* @example
|
|
42
44
|
* ```ts
|
package/object.d.ts
CHANGED
|
@@ -43,8 +43,9 @@ export interface StreamObjOpts<T, K extends Keys<T>> extends CommonOpts {
|
|
|
43
43
|
*/
|
|
44
44
|
defaults: Partial<T>;
|
|
45
45
|
/**
|
|
46
|
-
* If true, attaches
|
|
47
|
-
*
|
|
46
|
+
* If true, attaches
|
|
47
|
+
* [`dedupe()`](https://docs.thi.ng/umbrella/transducers/functions/dedupe.html)
|
|
48
|
+
* transducer to each key's value stream to avoid obsolete downstream
|
|
48
49
|
* propagation when a key's value hasn't actually changed.
|
|
49
50
|
*
|
|
50
51
|
* @defaultValue true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.33",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
"test": "testament test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.6.
|
|
42
|
-
"@thi.ng/arrays": "^2.4.
|
|
43
|
-
"@thi.ng/associative": "^6.2.
|
|
44
|
-
"@thi.ng/atom": "^5.1.
|
|
45
|
-
"@thi.ng/checks": "^3.3.
|
|
46
|
-
"@thi.ng/errors": "^2.2.
|
|
47
|
-
"@thi.ng/logger": "^1.4.
|
|
48
|
-
"@thi.ng/transducers": "^8.3.
|
|
41
|
+
"@thi.ng/api": "^8.6.2",
|
|
42
|
+
"@thi.ng/arrays": "^2.4.7",
|
|
43
|
+
"@thi.ng/associative": "^6.2.21",
|
|
44
|
+
"@thi.ng/atom": "^5.1.27",
|
|
45
|
+
"@thi.ng/checks": "^3.3.6",
|
|
46
|
+
"@thi.ng/errors": "^2.2.7",
|
|
47
|
+
"@thi.ng/logger": "^1.4.6",
|
|
48
|
+
"@thi.ng/transducers": "^8.3.28"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@microsoft/api-extractor": "^7.33.7",
|
|
52
|
-
"@thi.ng/testament": "^0.3.
|
|
52
|
+
"@thi.ng/testament": "^0.3.8",
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
54
|
"tools": "^0.0.1",
|
|
55
55
|
"typedoc": "^0.23.22",
|
|
@@ -205,5 +205,5 @@
|
|
|
205
205
|
],
|
|
206
206
|
"year": 2017
|
|
207
207
|
},
|
|
208
|
-
"gitHead": "
|
|
208
|
+
"gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\n"
|
|
209
209
|
}
|
package/pubsub.d.ts
CHANGED
|
@@ -33,9 +33,10 @@ export interface PubSubOpts<A, B, T> {
|
|
|
33
33
|
* The actual topic (return value from `topic` fn) can be of any type `T`, or
|
|
34
34
|
* `undefined`. If the latter is returned, the incoming value will not be
|
|
35
35
|
* processed further. Complex topics (e.g objects / arrays) are allowed and
|
|
36
|
-
* they're matched against registered topics using
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* they're matched against registered topics using
|
|
37
|
+
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) by
|
|
38
|
+
* default (but customizable via `equiv` option). Each topic can have any number
|
|
39
|
+
* of subscribers.
|
|
39
40
|
*
|
|
40
41
|
* If a `xform` transducer is given, it is always applied prior to passing the
|
|
41
42
|
* input to the topic function. I.e. in this case the topic function will
|
package/pubsub.js
CHANGED
|
@@ -12,9 +12,10 @@ import { Subscription, subscription } from "./subscription.js";
|
|
|
12
12
|
* The actual topic (return value from `topic` fn) can be of any type `T`, or
|
|
13
13
|
* `undefined`. If the latter is returned, the incoming value will not be
|
|
14
14
|
* processed further. Complex topics (e.g objects / arrays) are allowed and
|
|
15
|
-
* they're matched against registered topics using
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* they're matched against registered topics using
|
|
16
|
+
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) by
|
|
17
|
+
* default (but customizable via `equiv` option). Each topic can have any number
|
|
18
|
+
* of subscribers.
|
|
18
19
|
*
|
|
19
20
|
* If a `xform` transducer is given, it is always applied prior to passing the
|
|
20
21
|
* input to the topic function. I.e. in this case the topic function will
|
package/stream.d.ts
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { CommonOpts, IStream, ISubscriber, ISubscription, StreamCancel, StreamSource, TransformableOpts, WithErrorHandlerOpts } from "./api.js";
|
|
2
2
|
import { Subscription } from "./subscription.js";
|
|
3
3
|
/**
|
|
4
|
-
* Creates a new {@link Stream} instance, optionally with given
|
|
5
|
-
*
|
|
4
|
+
* Creates a new {@link Stream} instance, optionally with given `StreamSource`
|
|
5
|
+
* function and / or options.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* If a `src` function is provided, the function will be only called
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* value propagation.
|
|
8
|
+
* If a `src` function is provided, the function will be only called (with the
|
|
9
|
+
* `Stream` instance as single argument) once the first subscriber has attached
|
|
10
|
+
* to the stream. If the function returns another function, it will be used for
|
|
11
|
+
* cleanup purposes if the stream is cancelled, e.g. if the first / last
|
|
12
|
+
* subscriber has unsubscribed (depending on `closeOut` option). Streams are
|
|
13
|
+
* intended as (primarily async) data sources in a dataflow graph and are the
|
|
14
|
+
* primary construct for the various `from*()` functions provided by this
|
|
15
|
+
* package. However, streams can also be triggered manually (from outside the
|
|
16
|
+
* stream), in which case the user should call `stream.next()` to cause value
|
|
17
|
+
* propagation.
|
|
19
18
|
*
|
|
20
19
|
* Streams (like {@link Subscription}) implement the
|
|
21
|
-
*
|
|
22
|
-
* stream's last received value. This is useful
|
|
23
|
-
* e.g. in combination with
|
|
24
|
-
* supports direct embedding of
|
|
25
|
-
* components (and will be deref them
|
|
26
|
-
* not yet emitted a value, value caching is
|
|
27
|
-
* is done, it will deref to `undefined`.
|
|
20
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) interface
|
|
21
|
+
* which provides read access to a stream's last received value. This is useful
|
|
22
|
+
* for various purposes, e.g. in combination with
|
|
23
|
+
* [`thi.ng/hdom`](https://thi.ng/hdom), which supports direct embedding of
|
|
24
|
+
* streams (i.e. their values) into UI components (and will be deref them
|
|
25
|
+
* automatically). If the stream has not yet emitted a value, value caching is
|
|
26
|
+
* disabled or if the stream is done, it will deref to `undefined`.
|
|
28
27
|
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```ts
|
package/subscription.d.ts
CHANGED
|
@@ -3,35 +3,34 @@ import type { Reducer, Transducer } from "@thi.ng/transducers";
|
|
|
3
3
|
import { Reduced } from "@thi.ng/transducers/reduced";
|
|
4
4
|
import { CloseMode, CommonOpts, ISubscriber, ISubscription, State, SubscriptionOpts, TransformableOpts, WithErrorHandlerOpts, WithTransform } from "./api.js";
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new {@link Subscription} instance, the fundamental datatype
|
|
7
|
-
*
|
|
6
|
+
* Creates a new {@link Subscription} instance, the fundamental datatype and
|
|
7
|
+
* building block provided by this package.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
|
-
* Most other types in rstream, including {@link Stream}s, are
|
|
11
|
-
*
|
|
10
|
+
* Most other types in rstream, including {@link Stream}s, are `Subscription`s
|
|
11
|
+
* and all can be:
|
|
12
12
|
*
|
|
13
|
-
* - connected into directed graphs (sync or async & not necessarily
|
|
14
|
-
* DAGs)
|
|
13
|
+
* - connected into directed graphs (sync or async & not necessarily DAGs)
|
|
15
14
|
* - transformed using transducers (incl. support for early termination)
|
|
16
15
|
* - can have any number of subscribers (optionally each w/ their own
|
|
17
16
|
* transducers)
|
|
18
|
-
* - recursively unsubscribe themselves from parent after their last
|
|
19
|
-
*
|
|
20
|
-
* - will go into a non-recoverable error state if none of the
|
|
21
|
-
*
|
|
22
|
-
* - implement the
|
|
17
|
+
* - recursively unsubscribe themselves from parent after their last subscriber
|
|
18
|
+
* unsubscribed (configurable)
|
|
19
|
+
* - will go into a non-recoverable error state if none of the subscribers has
|
|
20
|
+
* an error handler itself
|
|
21
|
+
* - implement the
|
|
22
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html)
|
|
23
|
+
* interface
|
|
23
24
|
*
|
|
24
|
-
* If a transducer is provided (via the `xform` option), all received
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* overridden).
|
|
25
|
+
* If a transducer is provided (via the `xform` option), all received values
|
|
26
|
+
* will be first processed by the transducer and only its transformed result(s)
|
|
27
|
+
* (if any) will be passed to downstream subscribers. Any uncaught errors
|
|
28
|
+
* *inside* the transducer will cause this subscription's error handler to be
|
|
29
|
+
* called and will stop this subscription from receiving any further values (by
|
|
30
|
+
* default, unless overridden).
|
|
31
31
|
*
|
|
32
|
-
* Subscription behavior can be customized via the additional (optional)
|
|
33
|
-
*
|
|
34
|
-
* further details.
|
|
32
|
+
* Subscription behavior can be customized via the additional (optional) options
|
|
33
|
+
* arg. See {@link CommonOpts} and {@link SubscriptionOpts} for further details.
|
|
35
34
|
*
|
|
36
35
|
* @example
|
|
37
36
|
* ```ts
|
|
@@ -76,10 +75,10 @@ export declare class Subscription<A, B> implements ISubscription<A, B> {
|
|
|
76
75
|
subscribe(sub: Partial<ISubscriber<B>>, opts?: Partial<CommonOpts>): ISubscription<B, B>;
|
|
77
76
|
subscribe<C>(sub: Partial<ISubscriber<C>>, opts?: Partial<TransformableOpts<B, C>>): ISubscription<B, C>;
|
|
78
77
|
/**
|
|
79
|
-
* Creates a new child subscription using given transducers and
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
78
|
+
* Creates a new child subscription using given transducers and optional
|
|
79
|
+
* subscription ID. Supports up to 4 transducers and if more than one
|
|
80
|
+
* transducer is given, composes them in left-to-right order using
|
|
81
|
+
* [`comp()`](https://docs.thi.ng/umbrella/transducers/functions/comp.html).
|
|
83
82
|
*
|
|
84
83
|
* Shorthand for `subscribe(comp(xf1, xf2,...), id)`
|
|
85
84
|
*/
|
|
@@ -89,9 +88,10 @@ export declare class Subscription<A, B> implements ISubscription<A, B> {
|
|
|
89
88
|
transform<C, D, E, F>(a: Transducer<B, C>, b: Transducer<C, D>, c: Transducer<D, E>, d: Transducer<E, F>, opts?: Partial<WithErrorHandlerOpts>): ISubscription<B, F>;
|
|
90
89
|
transform<C>(opts: WithTransform<B, C> & Partial<WithErrorHandlerOpts>): ISubscription<B, C>;
|
|
91
90
|
/**
|
|
92
|
-
* Syntax sugar for {@link Subscription.transform} when using a
|
|
93
|
-
*
|
|
94
|
-
* function `fn` is used as `map`'s
|
|
91
|
+
* Syntax sugar for {@link Subscription.transform} when using a single
|
|
92
|
+
* [`map()`](https://docs.thi.ng/umbrella/transducers/functions/map.html)
|
|
93
|
+
* transducer only. The given function `fn` is used as `map`'s
|
|
94
|
+
* transformation fn.
|
|
95
95
|
*
|
|
96
96
|
* @param fn -
|
|
97
97
|
* @param opts -
|
package/subscription.js
CHANGED
|
@@ -12,35 +12,34 @@ import { CloseMode, State, } from "./api.js";
|
|
|
12
12
|
import { __optsWithID } from "./idgen.js";
|
|
13
13
|
import { LOGGER } from "./logger.js";
|
|
14
14
|
/**
|
|
15
|
-
* Creates a new {@link Subscription} instance, the fundamental datatype
|
|
16
|
-
*
|
|
15
|
+
* Creates a new {@link Subscription} instance, the fundamental datatype and
|
|
16
|
+
* building block provided by this package.
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
* Most other types in rstream, including {@link Stream}s, are
|
|
20
|
-
*
|
|
19
|
+
* Most other types in rstream, including {@link Stream}s, are `Subscription`s
|
|
20
|
+
* and all can be:
|
|
21
21
|
*
|
|
22
|
-
* - connected into directed graphs (sync or async & not necessarily
|
|
23
|
-
* DAGs)
|
|
22
|
+
* - connected into directed graphs (sync or async & not necessarily DAGs)
|
|
24
23
|
* - transformed using transducers (incl. support for early termination)
|
|
25
24
|
* - can have any number of subscribers (optionally each w/ their own
|
|
26
25
|
* transducers)
|
|
27
|
-
* - recursively unsubscribe themselves from parent after their last
|
|
28
|
-
*
|
|
29
|
-
* - will go into a non-recoverable error state if none of the
|
|
30
|
-
*
|
|
31
|
-
* - implement the
|
|
26
|
+
* - recursively unsubscribe themselves from parent after their last subscriber
|
|
27
|
+
* unsubscribed (configurable)
|
|
28
|
+
* - will go into a non-recoverable error state if none of the subscribers has
|
|
29
|
+
* an error handler itself
|
|
30
|
+
* - implement the
|
|
31
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html)
|
|
32
|
+
* interface
|
|
32
33
|
*
|
|
33
|
-
* If a transducer is provided (via the `xform` option), all received
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* overridden).
|
|
34
|
+
* If a transducer is provided (via the `xform` option), all received values
|
|
35
|
+
* will be first processed by the transducer and only its transformed result(s)
|
|
36
|
+
* (if any) will be passed to downstream subscribers. Any uncaught errors
|
|
37
|
+
* *inside* the transducer will cause this subscription's error handler to be
|
|
38
|
+
* called and will stop this subscription from receiving any further values (by
|
|
39
|
+
* default, unless overridden).
|
|
40
40
|
*
|
|
41
|
-
* Subscription behavior can be customized via the additional (optional)
|
|
42
|
-
*
|
|
43
|
-
* further details.
|
|
41
|
+
* Subscription behavior can be customized via the additional (optional) options
|
|
42
|
+
* arg. See {@link CommonOpts} and {@link SubscriptionOpts} for further details.
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
45
|
* ```ts
|
|
@@ -124,9 +123,10 @@ export class Subscription {
|
|
|
124
123
|
: opts));
|
|
125
124
|
}
|
|
126
125
|
/**
|
|
127
|
-
* Syntax sugar for {@link Subscription.transform} when using a
|
|
128
|
-
*
|
|
129
|
-
* function `fn` is used as `map`'s
|
|
126
|
+
* Syntax sugar for {@link Subscription.transform} when using a single
|
|
127
|
+
* [`map()`](https://docs.thi.ng/umbrella/transducers/functions/map.html)
|
|
128
|
+
* transducer only. The given function `fn` is used as `map`'s
|
|
129
|
+
* transformation fn.
|
|
130
130
|
*
|
|
131
131
|
* @param fn -
|
|
132
132
|
* @param opts -
|
package/sync.d.ts
CHANGED
|
@@ -87,9 +87,9 @@ export interface StreamSyncOpts<A extends IObjectOf<ISubscribable<any>>, B = Syn
|
|
|
87
87
|
* option to `false`.
|
|
88
88
|
*
|
|
89
89
|
* The synchronization is done via the
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* function's docs for further details.
|
|
90
|
+
* [`partitionSync()`](https://docs.thi.ng/umbrella/transducers/functions/partitionSync-1.html)
|
|
91
|
+
* transducer from the [`thi.ng/transducers`](https://thi.ng/transducers)
|
|
92
|
+
* package. See this function's docs for further details.
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* ```ts
|
package/sync.js
CHANGED
|
@@ -39,9 +39,9 @@ import { Subscription } from "./subscription.js";
|
|
|
39
39
|
* option to `false`.
|
|
40
40
|
*
|
|
41
41
|
* The synchronization is done via the
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* function's docs for further details.
|
|
42
|
+
* [`partitionSync()`](https://docs.thi.ng/umbrella/transducers/functions/partitionSync-1.html)
|
|
43
|
+
* transducer from the [`thi.ng/transducers`](https://thi.ng/transducers)
|
|
44
|
+
* package. See this function's docs for further details.
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```ts
|
package/tunnel.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export interface TunnelOpts<A> {
|
|
|
21
21
|
*/
|
|
22
22
|
id?: string;
|
|
23
23
|
/**
|
|
24
|
-
* Optional function to extract transferables from incoming stream
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Optional function to extract transferables from incoming stream values,
|
|
25
|
+
* e.g. ArrayBuffers. See:
|
|
26
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage
|
|
27
27
|
*/
|
|
28
28
|
transferables?: Fn<A, any[]>;
|
|
29
29
|
/**
|
package/view.d.ts
CHANGED
|
@@ -39,30 +39,31 @@ export type FromViewUnsafeOpts<T> = FromViewOpts<Path, any, T>;
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const fromViewUnsafe: <T>(atom: ReadonlyAtom<any>, opts: FromViewUnsafeOpts<T>) => Stream<T extends undefined ? any : T>;
|
|
41
41
|
/**
|
|
42
|
-
* Similar to {@link fromAtom}, but creates a type checked, eager
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* Similar to {@link fromAtom}, but creates a type checked, eager derived view
|
|
43
|
+
* for a nested value in an Atom-like state container and yields stream of its
|
|
44
|
+
* value changes.
|
|
45
45
|
*
|
|
46
46
|
* @remarks
|
|
47
|
-
* Stream value type is inferred from target path or (if given), the
|
|
48
|
-
*
|
|
47
|
+
* Stream value type is inferred from target path or (if given), the result type
|
|
48
|
+
* of the optional view transformer (`tx` option).
|
|
49
49
|
*
|
|
50
|
-
* Views are readonly and more lightweight versions of
|
|
51
|
-
*
|
|
52
|
-
* changes with given `equiv` predicate (default:
|
|
53
|
-
*
|
|
54
|
-
* (i.e. there's a new value), the new value is
|
|
55
|
-
* The first value emitted is always the (possibly
|
|
56
|
-
* value at the stream's start time (i.e. when the first
|
|
57
|
-
* attaches).
|
|
50
|
+
* Views are readonly and more lightweight versions of [thi.ng/atom
|
|
51
|
+
* cursors](https://docs.thi.ng/umbrella/atom/classes/Cursor.html). The view
|
|
52
|
+
* checks for value changes with given `equiv` predicate (default:
|
|
53
|
+
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html)). If the
|
|
54
|
+
* predicate returns a falsy result (i.e. there's a new value), the new value is
|
|
55
|
+
* emitted on the stream. The first value emitted is always the (possibly
|
|
56
|
+
* transformed) current value at the stream's start time (i.e. when the first
|
|
57
|
+
* subscriber attaches).
|
|
58
58
|
*
|
|
59
59
|
* If the `tx` option is given, the raw value is first passed to this
|
|
60
60
|
* transformer function and its result emitted on the stream instead.
|
|
61
61
|
*
|
|
62
62
|
* When the stream is cancelled the view is destroyed as well.
|
|
63
63
|
*
|
|
64
|
-
* Also see
|
|
65
|
-
*
|
|
64
|
+
* Also see
|
|
65
|
+
* [`defView()`](https://docs.thi.ng/umbrella/atom/functions/defView.html),
|
|
66
|
+
* [`defViewUnsafe()`](https://docs.thi.ng/umbrella/atom/functions/defViewUnsafe.html)
|
|
66
67
|
*
|
|
67
68
|
* @example
|
|
68
69
|
* ```ts
|