UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

35 lines (31 loc) 805 B
import { DebounceState } from '#transformers/debounce/State' /** * Debouncing requires at least one behavior that implements * the DebounceBehavior. * * @group Transformers * @see {@link debounce:function} */ export interface DebounceBehavior<T> { /** * Called only once, when the debouncer is constructed. */ init?(state: DebounceState): DebounceState | void /** * This is will be called once for every chunk received and before * the timer has been set. */ preTimer?( state: DebounceState, chunk: T, controller: TransformStreamDefaultController<T> ): DebounceState | void /** * Called after timer has timed out. */ postTimer?( state: DebounceState, chunk: T, controller: TransformStreamDefaultController<T> ): DebounceState | void }