Skip to content

Function: deferred() ​

deferred<TArgs, ThisArg, Delay>(callback, delay?, options?): (...args) => void

Defined in: packages/core/src/deferred/deferred.ts:18

Returns a function that can be used to debounce/throttle calls to the provided callback function. All errors will be gracefully swallowed. See debounce and throttle for more information.

Type Parameters ​

TArgs ​

TArgs extends unknown[]

ThisArg ​

ThisArg

Delay ​

Delay = unknown

Parameters ​

callback ​

(this, ...args) => unknown

function to be invoked after delay

delay? ​

Delay = ...

(optional) delay duration in milliseconds. Default: 50

options? ​

DeferredOptions<ThisArg> = {}

(optional) debounce or throttle configuration options

Returns ​

Callback function that can be invoked in one of the following 2 methods:

  • debounced: when throttle is false or undefined
  • throttled: when throttle is true

(...args) => void