The function to throttle
The number of milliseconds to throttle invocations to
Optional
options:
{ The options object
Optional
leading?: boolean
Specify invoking on the leading edge of the timeout
Optional
trailing?: boolean
Specify invoking on the trailing edge of the timeout
Returns the new throttled function
Generated using TypeDoc
Creates a throttled function that only invokes
funcat most once per everywaitmilliseconds (or once per browser frame). Provideoptionsto indicate whetherfuncshould be invoked on the leading and/or trailing edge of thewaittimeout. Thefuncis invoked with the last arguments provided to the throttled function. Subsequent calls to the throttled function return the result of the lastfuncinvocation. Note: Ifleadingandtrailingoptions aretrue,funcis invoked on the trailing edge of the timeout only if the throttled function is invoked more than once during thewaittimeout. Ifwaitis0andleadingisfalse,funcinvocation is deferred until the next tick, similar tosetTimeoutwith a timeout of0.