Interface ThrottleSettings

These settings control the behavior of the throttle function.

Hierarchy

  • ThrottleSettings

Properties

cooldownMs: number

Number of milliseconds to wait between function calls. If the cooldown should never expire, use Number.POSITIVE_INFINITY.

Default Value

100

executionEdge: "leading" | "trailing" | "both"

Specify which side of the cooldown period the underlying function is allowed to be executed.

"leading" - the underlying function is called immediately when the throttled function is invoked with no cooldown in effect.

"trailing" - the underlying function is queued to be called as soon as the cooldown is complete.

"both" - the underlying function is called immediately when the throttled function is invoked with no cooldown in effect. If the throttled function is invoked during the cooldown, queues the underlying function to be called when the cooldown is over.

Default Value

"both"

mode: "throttle" | "debounce"

The behavior for when the function is called during the cooldown period.

"throttle" - Ignore the call and do not reset the cooldown period. This is used to implement typical "throttle" behavior.

"debounce" - Reset the cooldown period.

Default Value

"throttle"

Generated using TypeDoc