audit()
audit: VALUE-TRIGGERED trailing throttle. A source value (when no window is open) opens a duration
window via durationSelector(value) → a notifier NodeInput wired as dep 1 with ctx.rewireNext
(D47 — the *Map self-rewire idiom, NOT an internal subscribe, D45); during the window new source
values only UPDATE the tracked latest (no emit); when the notifier fires (its first DATA / COMPLETE)
the window closes and the LATEST value is emitted. This is throttle’s trailing-edge twin
(throttle emits the window’s FIRST value at the leading edge; audit emits the LAST at the close).
durationSelector is the general/notifier form (mirrors the *Map Project idiom + D46); the source
is dep 0, the live notifier (if any) is dep 1. On source COMPLETE the pending latest is FLUSHED then
COMPLETE (RxJS-7 audit flush-on-complete, B44). A source/notifier ERROR is read as a real terminal
input so the live notifier can be removed before ERROR. Self-catching (D30); re-supplies its body on
every rewire.
Import
Section titled “Import”import { audit } from "@graphrefly/ts/operators";Signature
Section titled “Signature”function audit(durationSelector: (v: S) => NodeInput<unknown>): Operator<S, S>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
durationSelector | (v: S) => NodeInput<unknown> | duration selector value used by the helper. |
Returns
Section titled “Returns”A Operator<S, S> value.
Example
Section titled “Example”import { audit } from "@graphrefly/ts/operators";Source
Section titled “Source”packages/ts/src/graph/time.ts