Skip to main content

Interface: DebouncedFunc<FnArgumentsType, FnReturnType>

@sapphire/utilities.DebouncedFunc

Type parameters

NameType
FnArgumentsTypeextends any[]
FnReturnTypeFnReturnType

Callable

DebouncedFunc

โ–ธ DebouncedFunc(...args): undefined | FnReturnType

Call the original function, but applying the debounce rules.

If the debounced function can be run immediately, this calls it and returns its return value.

Otherwise, it returns the return value of the last invokation, or undefined if the debounced function was not invoked yet.

Parameters

NameType
...argsFnArgumentsType

Returns

undefined | FnReturnType

Defined in

projects/utilities/packages/utilities/src/lib/debounce/index.ts:34

Methods

cancel

โ–ธ cancel(): void

Throw away any pending invokation of the debounced function.

Returns

void

Defined in

projects/utilities/packages/utilities/src/lib/debounce/index.ts:39


flush

โ–ธ flush(): undefined | FnReturnType

If there is a pending invokation of the debounced function, invoke it immediately and return its return value.

Otherwise, return the value from the last invokation, or undefined if the debounced function was never invoked.

Returns

undefined | FnReturnType

Defined in

projects/utilities/packages/utilities/src/lib/debounce/index.ts:48