0.0.2 • Published 8 years ago

sequencer-js v0.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

sequencer

executes promise in a sequence

var sequencer = require('sequencer-js')()
var bluebird = require('bluebird')

var globalVariable = 1

function aPromise(id, ts) {
  return bluebird.delay(ts).then(function(){
     globalVariable++
    console.log(id, globalVariable)
  })
}

sequencer.push(aPromise.bind(undefined, "first", 1000))
sequencer.push(aPromise.bind(undefined, "second", 10))