@epikodelabs/streamix / sample
Function: sample()
sample<
T>(period):Operator<T,T>
Defined in: projects/libraries/streamix/src/lib/operators/sample.ts:15
Creates a stream operator that emits the most recent value from the source stream at a fixed periodic interval.
Values that arrive between sample ticks and are not emitted are forwarded with dropped: true so that backpressure is released without surfacing them as real emissions.
Type Parameters
T
T = any
The type of the values in the source and output streams.
Parameters
period
MaybePromise<number>
The time in milliseconds between each emission.
Returns
Operator<T, T>
An Operator instance for use in a stream's pipe method.