throttly
Yet another throttle implementation with 0 dependencies
Usage
var throttly = ;
signature
:Function
- fnToThrottle: Function The function to throttle
- threshold: Number The number of milliseconds for the throttle rate
- ctx: Object The this object inside the throttled function. If none specified will try to use the ctx of the invocator.
- immediate: Boolean If true, the function will be executed on the leading edge
Install
npm i --save throttly
Example
var throttly = ; var throttledFn = ;;// after 200ms// output: I am calledvar ctx = name: 'some obj';var throttledFn = ;;// after 200ms// output: I am called from some obj var throttledFn = ;;// immediately// output: I am called// other calls will have to wait 200ms before the last execution