Skip to content

Function: createThrottle() ​

ts
function createThrottle(run, intervalMs, clock?): object;

Experimental

Leading + trailing throttle: the first request after an idle period runs immediately; requests inside the interval coalesce into one trailing run, so the final state is always computed.

Parameters ​

ParameterTypeDefault value
run() => voidundefined
intervalMsnumberundefined
clockThrottleClockdefaultClock

Returns ​

object

NameType
cancel()() => void
flush()() => void
request()() => void

Released under the MIT License.