UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

52 lines 1.51 kB
import type { DebounceBehavior } from './debounce/Behavior.js'; import { DebounceTrailingBehavior } from './debounce/TrailingBehavior.js'; export { type DebounceBehavior, DebounceTrailingBehavior }; export * from './debounce/BackOffBehavior.js'; export * from './debounce/State.js'; export * from './debounce/LeadingBehavior.js'; /** * Delays queuing until after `ms` milliseconds have elapsed * since the last time this transformer received anything. * The queuing behavior is configurable. * * @see {@link DebounceLeadingBehavior:class} * @see {@link DebounceTrailingBehavior:class} * @see {@link DebounceBackOffBehavior:class} * @group Transformers * @example * Using the trailing behavior. * ``` * --a-b-c--------------d----------- * * debounce(20) * // Same as... * debounce(20, new DebounceTrailingBehavior()) * * -------------c---------------d--- * ``` * * @example * Using the leading behavior. * ``` * --a-b-c--------------d----------- * * debounce(20, new DebounceLeadingBehavior()) * * ---a------------------d---------- * ``` * * @example * Using both leading and trailing behaviors * ``` * --a-b-c--------------d----------- * * debounce(20, [ * new DebounceLeadingBehavior(), * new DebounceTrailingBehavior() *]) * * ---a----------c--------d---------- * ``` */ export declare function debounce<T>(ms: number, behaviors?: DebounceBehavior<T> | DebounceBehavior<T>[]): import("node:stream/web").TransformStream<T, T>; //# sourceMappingURL=debounce.d.ts.map