1.1.0 • Published 9 years ago
cooled v1.1.0
cooled
Make function with a cooldown to avoid too Frequent call
Installation
npm i cooled
Api
cooled(func, timeLimit)
Usage
var cooled = require('cooled')
var fn = cooled(function() {
// do something
}, 1000)
setInterval(fn, 20)
Advanced
The function returned can be called with arguments
var fn = cooled(function() {
console.log(this, arguments)
}, 1000)
fn.call({foo: 'bar'}, 1, 2)