You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Creates an `iterified` async iterable, yielding each value as it gets emitted from the user-provided `executorFn`.
15
+
*
16
+
* The given _executor function_ will be _"lazily"_ executed only upon pulling the first value from any iterator (or [`for await...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) loop) of the `iterified` iterable. Any additional iterators obtained from that point on would all feed off of the same shared execution of the _executor function_ - every value it yields will be distributed ("multicast") down to each active iterator, picking up from the time it was obtained. When the iterable is ended either by the producer (_executor function_ calls `done()` or `error(e)`) or the consumer (last active iterator is closed) - it would trigger an optionally-given teardown function before finally closing off the `iterified` iterable. This life cycle __repeats__ from the begining every time the `iterified` iterable gets reconsumed again.
17
+
*
18
+
* @param executorFn - a user-provided _executor function_ (see {@link ExecutorFn}) that controls the values to emit through the `iterified` iterable, closing it or erroring out, and provides logic for teardown.
* A function that expresses the values to emit through an `iterified` iterable and encapsulates any logic and resource management that should be involved in generating them.
179
+
*
180
+
* The _executor function_ is invoked with the following arguments:
181
+
*
182
+
* - `next(value)` - makes the iterable yield `value` to all consuming iterators
183
+
* - `done()` - makes the iterable end, closing all consuming iterators
184
+
* - `error(e)` - makes the iterable error out with given `e` and end, propagating the error to every consuming iterator
185
+
*
186
+
* In addition, the _executor function_ may __optionally__ return a teardown function for disposing of any state and open resources that have been used during execution.
0 commit comments