The type of items contributed to the feed
The function called repeatedly to produce the next value, reported either as it is or as a promise, or done to end the feed
Optionalsignal: AbortSignalThe optional signal bounding the feed from the outside; if omitted, the source alone decides how far the feed goes
A feed yielding the values reported by successive source calls, until either the source reports
done or signal is aborted
await pipe(
(inlet(() => Math.random()))
(take(3))
(toArray())
); // [0.123, 0.456, 0.789]
await pipe(
(inlet(() => queue.size ? queue.poll() : done))
(toArray())
); // every value queued, until the queue runs dry
await pipe(
(inlet(() => cursor.next(), AbortSignal.timeout(1_000)))
(toArray())
); // every value the cursor reports within the deadline
AbortSignal
Creates a feed over an external source of items, drawn one at a time on demand.
Random generators, queues, cursors, event subscriptions and any other source handing over one value per call enter a pipe through this feed, called again once the value it reported last has been consumed. Every value is contributed as a single item, whatever its shape and without being expanded further, so arrays and iterables are carried whole and falsy values,
undefinedincluded, are preserved; a promised value is awaited before being contributed.The feed ends where the source reports done in place of a value, the marker itself withheld from the items: a source knowing when it is exhausted bounds the feed at the origin, without a wrapper generator of its own.
The optional
signalbounds the feed from the outside, tested before each call: an aborted signal ends the feed as an exhausted source does, so a deadline or a withdrawn request leaves the items already contributed to the pipe that consumes them. A cancellation asked for while a promised value is in flight takes effect once that value has been contributed, andsignal.abortedtells a partial outcome from a complete one.Infinite: the feed runs on unless
sourcereports done orsignalis aborted, so a source that never ends it leaves it to be bounded downstream, by a task such as take or by a sink deciding its outcome early.