BACK
Referenceaudit
Reference · 39

audit

Ignores values during a window, then emits the last one.

Signature

audit(durationSelector: (value: T) => ObservableInput): MonoTypeOperatorFunction

Marble diagram

a-b-c----| + audit(timer)  →  ----c|

What it does

After the first value it starts durationSelector and stays quiet until the inner Observable completes. Then it emits the last value that arrived during that window and is ready to open a new one.

When to use

When the final snapshot of a burst matters: resize, scroll, drag, recomputing layout after a series of rapid changes.

See also

auditTime, debounce, throttle

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...