Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / audit

Function: audit()

audit<T>(duration): Operator<T, T>

Defined in: projects/libraries/streamix/src/lib/operators/audit.ts:17

Creates a stream operator that emits the latest value from the source stream at most once per specified duration.

Each incoming value is stored as the "latest"; a timer emits that latest value when the duration elapses. All values that arrive between timer ticks and are ultimately superseded 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 stream.

Parameters

duration

MaybePromise<number>

The time in milliseconds (or a promise resolving to it) to wait before emitting the latest value.

Returns

Operator<T, T>

An Operator instance that can be used in a stream's pipe method.

Released under the GNU AGPL v3 or later.