sleepqueue
A promise-based queue that sleeps between callbacks.
Installation
$ npm i sleepqueue -S
Usage
General
var sleepqueue = ; // create a queue with an interval of 1 secondvar queue = ; // `push` pushes to the end of the queuequeue;queue;queue;queue; // `unshift` pushes to the start of the queuequeue; // just a helper function { return { console; };}
Output:
Hi
# (wait 1 second)
My name is
# (wait 1 second)
My name is
# (wait 1 second)
My name is
# (wait 1 second)
Slim Shady
Errors
Uncaught errors and rejected promises will stop the queue and emit an error event.
queue;queue;queue; queue;
Output:
Hello
Error: I stopped the queue