generic functions for throttling function calls
npm install function-throttlergeneric throttling functions as a npm package
#### Table of Contents
- limit
- throttleAndQueue
- throttledUpdate
- throttle
class for limiting the rate of function calls.
Thanks to Pat Migliaccio.
see
Examples
``javascript`
let l = new limit(); let logMessageLimited = l.throttleAndQueue(msg => { console.log(msg); }, 500);
#### throttleAndQueue
Returns a version of your function that can be called at most every W milliseconds, where W is wait.
Calls to your func that happen more often than W get queued up to be called every W ms
Parameters
- fn wait
-
#### throttledUpdate
Returns a version of your function that can be called at most every W milliseconds, where W is wait.
for calls that happen more often than W the last call will be the one called
Parameters
- fn wait
-
limits your function to be called at most every W milliseconds, where W is wait.
Calls over W get dropped.
Thanks to Pat Migliaccio.
see
Parameters
- fn wait
-
Examples
`javascript``
let throttledFunc = throttle(myFunc,500);