Skip to main content

Function: throttle()

throttle<T>(func: T, wait: number): ThrottleFn<T>

Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled function comes with a flush method to reset the last time the throttled function was invoked.

Type Parameters

Type Parameter
T extends (...args: any[]) => any

Parameters

ParameterTypeDescription
funcTThe function to throttle.
waitnumberThe number of milliseconds to throttle invocations to.

Returns

ThrottleFn<T>

Returns the new throttled function.

Defined in

throttle.ts:13