Throttled scroll and resize event via requestAnimationFrame.
Based on this article
Install with component(1):
$ component install mnmly/throttled
var Throttled = require('throttled');
var throttled = new Throttled(); // Probably better to be used as singleton.
throttled.on('scroll', function(){
console.log('clean scroll');
});
throttled.on('resize', function(){
console.log('clean resize');
});
// If you don't want this anymore.
throttled.destroy();
- Allow attatching
scroll
event other thanwindow
MIT