0.1.0 • Published 8 years ago
onframe v0.1.0
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);
0.1.0
8 years ago