le-schedule
v1.0.0
Published
Quick implementation of throttle() and debounce() functions
Downloads
1
Readme
le-schedule
Quick implementation of throttle()
and debounce()
functions
Installation
npm
npm intall le-schedule
git
git clone https://github.com/levanroinishvili/le-schedule.git
Usage
CommonJS (including node.js)
- First, acquire the functions through either
let {_throttle : throttle, _debounce : debounce} = require('le-schedule');
or
const le_schedule = require('le-schedule');
const throttle = le_schedule._throttle;
const debounce = le_schedule._debounce;
- Then use them like this:
debounce(f, dt[, thisObject[, arguments]]);
throttle(f, dt[, thisObject[, arguments]]);
Example
let {_throttle : throttle, _debounce : debounce} = require('le-schedule');
myButton.addEventListener('click',debounce(function(event) { console.log(event);}, 1000));