QubitProducts / slapdash

A lightweight JavaScript utility belt with native method override protection
http://npmjs.org/packages/slapdash
MIT License
3 stars 1 forks source link

Throttle #57

Open kayleQubit opened 4 years ago

kayleQubit commented 4 years ago

Added a simple throttle function. It will take a function and limit invocations within a time defined in second parameter:

var thr = throttle(tothr, 90) thr() thr() setTimeout(() => thr(), 30) setTimeout(() => thr(), 110)

would expect to have called the function only twice.