1.1.1 • Published 5 years ago
with-raf v1.1.1
Higher Order Function for requestAnimationFrame
Throttling
A simple higher order function to throttle a function by animation frames.
Install
npm -i -D with-raf
API
withRaf(fn, onCall, raf = window.requestAnimationFrame)
fn
is a function to be throttledonCall
is a callback function that is trigger oncefn
is called. It receives the return value offn
as its arguments.raf
is an option to use a polyfill forwindow.requestAnimationFrame
Returns: the animation frame-throttled version of fn
.