Class DebounceBackOffBehavior<T>

A behavior that will increase the debounce time whenever events are received within the current time. It's best to be used in conjunction with the DebounceTrailingBehavior:class or the DebounceLeadingBehavior:class.

See

debounce:function

Example

--a--b---c----d----|

debounce(5, [
new DebounceBackOffBehavior({ inc: (ms) => ms * 2 }),
new DebounceTrailingBehavior(),
])

--T5-T10-T20--T40-d-

Type Parameters

  • T

Implements

Constructors

Properties

Methods

Constructors

Properties

#inc: ((currentMS) => number)

Type declaration

    • (currentMS): number
    • Parameters

      • currentMS: number

      Returns number

#max: number
#startingMS: number = 0

Methods

  • This is will be called once for every chunk received and before the timer has been set.

    Parameters

    • state: Readonly<{
          ms: number;
          queued: boolean;
          timer?: number;
      }>

    Returns {
        ms: number;
        queued: boolean;
        timer?: number;
    }

    • ms: number
    • queued: boolean

      Whether or not the current chunk was queued to the next Readable.

    • Optional timer?: number

      The timer Id/handle.

Generated using TypeDoc