Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 699 Bytes

Readme.md

File metadata and controls

38 lines (23 loc) · 699 Bytes

throttled

Throttled scroll and resize event via requestAnimationFrame.

Based on this article

Installation

Install with component(1):

$ component install mnmly/throttled

Usage

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();

Todo

  • Allow attatching scroll event other than window

License

MIT