onframe
v0.1.0
Published
Debounced requestAnimationFrame
Downloads
4
Maintainers
Keywords
Readme
onFrame
Debounces requestAnimationFrame
API
onFrame(fn, frameLength = 10);fn
Callback function
frameLength
Length of frames to wait before callback is called
Example
import onFrame from 'onframe';
const efficientResize = onFrame(function() {
// will be debounced to after 5 frames
}, 5);
window.addEventListener('resize', efficientResize);
