GraphReFlyTS

API Reference

debounce()

debounce (alias debounceTime): emit the latest value only after ms of quiet. switchMap cancels the prior timer (its onDeactivation clearTimeout) on each new source value and restarts — the declarative debounce.

RxJS-7 divergence (reference [email protected], B44): RxJS debounceTime FLUSHES the pending value IMMEDIATELY when the source COMPLETEs (its _complete calls debouncedNext() before complete()). This composition instead emits the pending value when the in-flight timer(ms) fires — i.e. at (last-value-time + ms) — so if the source completes mid-window the trailing value arrives up to ms later than RxJS. Inherent to the *Map+timer form (the composition cannot flush early without detecting COMPLETE inside the switchMap inner); accepted, not a bug.

Import

import { debounce } from "@graphrefly/ts/operators";

Signature

function debounce(ms: number): Operator<S, S>

Parameters

ParameterTypeDescription
msnumberDuration or timestamp in milliseconds.

Returns

A Operator<S, S> value.

Example

import { debounce } from "@graphrefly/ts/operators";

Source

packages/ts/src/graph/time.ts