Use throttle with requestAnimationFrame with the options of frame selection (either leading edge or trailing edge.)
Lets you create a throttled function, which only invokes the passed function at most once per animation frame on a browser or per 1000/60 ms on Node. Additionally, the arguments to the function call can be controlled (Leading or Trailing by passing as argument to the throttle function along with the callback function)
Demo Work in progress.
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
- Pull requests must be accompanied by passing automated tests (
$ npm test
).