function-queue

Simple queue to execute any function on FIFO order.

FunctionQueue

Simple queue to execute any function on FIFO order.

No installation is needed.

var FunctionQueue = require("./../src/function-queue.js")();
FunctionQueue.push(function (callback) {
    console.log("dede");
    setTimeout(function () {
        console.log("timeout");
        //you must call callback to continue queue
        callback()
    },1000);
})
FunctionQueue.push(function (callback) {
    console.log("dedeOut");
    //you must call callback to continue queue
    callback();
})

More samples at samples/ directory.

Sample:

var FunctionQueue = require("./../src/function-queue.js")();

Parameters:

  • function - **Type:**function - **Description:**Function to be added on queue. - REQUIRED

Sample:

FunctionQueue.push(function (callback) {
    console.log("dedeOut");
    //you must call callback to continue queue
    callback();
})

Functions already started will not be canceled.

Sample:

FunctionQueue.removeAllObjects();
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

MIT