Skip to content

Instantly share code, notes, and snippets.

View banksJeremy's full-sized avatar

Jeremy Banks banksJeremy

View GitHub Profile
Throttle decorator parameters:
f - function
interval - number - the minimum duration in miliseconds between calls
keep - FIRST/LAST/ALL - which function calls will be kept if throttling must occur
wait - NONE/INTERVAL/IDLE - how long to wait after getting the first call before making a call
- if NONE the call will be made immediately
- if INTERVAL the call will be made after interval ms have elapsed since the first call
- if IDLE the call will be made after interval ms have elasped without a call
wait-interval - optional number - can be used to override the wait interval, instead of using the standard interval.
must be <= interval