Queue

Queue

a lib to build async task queue

Constructor

new Queue(optionsopt)

Source:
Author:
Properties:
Name Type Description
tasks Array.<function()> Task queue array
Constructor
Parameters:
Name Type Attributes Description
options Object <optional>
not support any config now

Methods

push(task) → {task}

push the task into the queue.

Source:
push the task into the queue
Example
queue.push(function (value, next) {
   // do something
   next();
});
Parameters:
Name Type Description
task task task
Returns:
next task
Type
task

start(callbackopt) → {void}

start the queue task.

Source:
start the queue task
Example
let queue = new Queue();
queue.push(function(undefined,next){
 console.log('run first task');
 next();
});
queue.start(function(err, data){
  console.log(err);    // null
  console.log(data);   // undefined
});

// output 'run first task';
Parameters:
Name Type Attributes Description
callback init <optional>
callback function
Returns:
Type
void