@epikodelabs/streamix / exhaustMap
Function: exhaustMap()
exhaustMap<
T,R>(project):Operator<T,R>
Defined in: projects/libraries/streamix/src/lib/operators/exhaustMap.ts:32
Maps each value from the source stream to an inner stream, ignoring new outer values while the current inner stream is still executing.
This operator is useful for preventing overlapping operations (e.g., preventing multiple simultaneous form submissions or API calls). If a new value arrives from the source while an earlier projected stream is still active, that new value is silently discarded.
- Only after the current inner stream completes will the operator become "idle" and ready to accept the next value from the source.
Type Parameters
T
T = any
The type of values emitted by the source stream.
R
R = T
The type of values emitted by the produced inner streams.
Parameters
project
(value, index) => Stream<R> | MaybePromise<R> | R[]
A function that transforms a source value into a Stream, a MaybePromise, or an array. It receives the source value and a zero-based index of the emission.
Returns
Operator<T, R>
An Operator that performs the "exhaust" transformation.