A promise execution flow control library
npm install schedulerjsA wrapper around Promise to control the execution flow

Released under MIT License
Install mocha : npm install -g mocha
Start tests with : npm test
Sequence will execute Promises in serie
Example :
``js
let seq = new Sequence();
seq
.next(() => {
return promise;
})
.delay(500)
.next(() => {
return new Promise((resolve, reject) => {
resolve();
});
})
.start();
seq.on('started', () => {
console.log('Sequence started');
});
seq.on('next', (pos, total) => {
console.log(${pos} / ${total});
});
seq.on('error', err => {
console.log(A promise rejected with ${err});
});
seq.on('stopped', () => {
console.log('Sequence stopped');
});
seq.on('finished', () => {
console.log('Sequence finished');
});
`
* constructor() initializes the sequencenext(Function callback) → Sequence
* adds a function to the queuedelay(Number number) → Sequence
* adds a timeout function to the queuestop()
* stops the sequencestart()
* starts the sequence
* error(Object err) triggered when a Promise rejectedfinished()
* triggered when all the Promise were finishednext(Number position, Number total)
* triggered when one promise finished.started
* triggered when the sequence was startedstopped
* triggered when the sequence was stopped
Scheduler will execute Sequences in parallel
Example :
`js
let scheduler = new Scheduler();
let seq1 = new Sequence();
let seq2 = new Sequence();
seq1
.next(...)
.delay(500)
.next(...);
seq2
.next(...)
.next(...);
scheduler
.add(seq1)
.set('othername', seq2) // sets scheduler.othername to seq2
.start();
`
* constructor() initializes the scheduleradd(Sequence seq) → Scheduler
* adds a sequence to the parallel queueset(String name, Sequence seq) → Scheduler
* same as add, but sets the reference inside the schedulerstart()
* starts all the sequencesstop()
* stops all the sequences
* error(Object err) triggered when one sequence triggered errorstarted
* triggered when the scheduler was startedfinished
* triggered when all the sequences triggered finishedstopped` triggered when the scheduler was stopped
*