async-function-queue
v1.0.0
Published
Async Function Queue
Downloads
1,393
Readme
async-function-queue
Simple async function queue.
Install
$ npm install async-function-queue --save
Use
var Queue = require('async-function-queue');
var concurrency = 2;
// create a queue, defining concurrency
var queue = Queue(concurrency);
// push a function that accepts a callback
// as sole argument
queue.push(function(cb) {
setTimeout(cb, 1000);
});
Events
// Some emitted events
queue.on('entry', function() {
console.log('starting to execute function');
});
queue.on('exit', function() {
console.log('finished executing function');
});
queue.on('drain', function() {
console.log('queue has drained');
});
License
ISC