sla
v0.0.3
Published
A module which avoid boilerplate code when coding an SLA function in Node
Downloads
5
Readme
node-sla
A tiny SLA node module that avoids setTimeout boilerplate code and allows an elapsed callback to be passed.
Example
var sla = require('sla');
//Will execute the code in the first callback
sla(1000, function(done) {
console.log("Waiting....");
setTimeout(done,900);
}, function() {
console.log("Elapsed");
});
//Will execute the code in the second(elapsed) callback
sla(1000, function(done) {
console.log("Waiting....");
setTimeout(done,1001);
}, function() {
console.log("Elapsed");
});
Installation
$ npm install sla