throttle()

Creates a throttled version of a function which will only be executable once per every specified wait period.

This function is valid in v2.16.0 to v2.23.0. This function has been downloaded 27 times.

Parameters

{Function} fn
The function which will esentially be rate-limited.
{number} msBetweenCalls
The amount of time to wait between calls.
{boolean=} opt_leading Optional, Default:undefined
If true the fn function will only be invoked on the initial calls if the specified time has elapsed since the last invocation. If false the fn function will only be invoked on the trailing calls. If not specified or if specified as null or undefined the initial calls and the trailing calls will be used to invoke fn.

Returns

{Function}
The throttled version of fn function.

Required Function

This function directly requires the following function which is included automatically:

  • debounce()
    Creates a debounced copy of the function which when called will delay the execution until the specified amount of milliseconds have elapsed since the last time it was called.

Requiring Function

This function is directly required by the following function:

  • debounce()
    Creates a debounced copy of the function which when called will delay the execution until the specified amount of milliseconds have elapsed since the last time it was called.