then-queue
a simple asynchronous queue
Installation
npm install then-queue
API
new Queue()
```js var Queue = require('then-queue'); var q = new Queue(); ``` A fresh queue!queue.push(item)
Push an item onto the queuequeue.pop() -> Promise Item
Pop an item from the queuequeue.length
Amount of items in the queue (note that this can be negative ifpop
has been called more times than push
).
Events
Thelength-changed
event gets emitted whenever pop
or push
has been called. You could use it to spawn/kill workers when the length changes.