@seedalpha/debounce
v1.2.10
Published
Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked. Useful for implementing behavior that should only happen after the input ha
Downloads
6
Readme
debounce
Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed since the last time it was invoked. Useful for implementing behavior that should only happen after the input has stopped arriving.
For example: rendering a preview of a Markdown comment, recalculating a layout after the window has stopped being resized, and so on.
Changelog
1.0.0
:
- Initial release
Installation
$ npm install seed-debounce --save
Usage
var debounce = require('seed-debounce');
var count = 0;
var fn = debounce(function() {
count++;
}, 300);
fn();
fn();
fn();
count === 1; // true
setTimeout(function(){
count === 2; // true
}, 300);
Development
$ git clone [email protected]:seedalpha/debounce.git
$ cd debounce
$ npm install
$ npm test
Author
Vladimir Popov [email protected]
License
©2014 Seedalpha