sla

A module which avoid boilerplate code when coding an SLA function in Node

node-sla

A tiny SLA node module that avoids setTimeout boilerplate code and allows an elapsed callback to be passed.

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");
  });
$ npm install sla