1.0.4 • Published 6 years ago

juqueue v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

ju Queue

For proper coding and to run sequential asynchronous function.

Installation

$ npm install juqueue

Usage

var juQueue = require('juqueue');

// To set juQueue options.

juQueue.set({
  running: true,
  pauseTime: 1000
});

// or

juQueue.set("running", true);
juQueue.set("pauseTime", 1000);

// No settings needed at the start. Because all settings have defaults.

// To use queue for functions.

juQueue.get({
  ecb: null, // Write function to catch error.
  list: [
    function (e) {
      //...
      e.next();
    },
    function (e) {
      //...
    }
  ]
});
var juQueue = require('juqueue');
juQueue.get({
  list: [
    function (e) {
      //...
      e.next({ name: "test", model: "test", args: [1, 2] });
    },
    function (e) {
      //...
      e.next();
    },
    function test(e, one, two) {
      var modelValue = e.model;
      //...
    }
  ]
});

Methods

juQueue.set([options]) or juQueue.set(key, value)

Parameters:

  • [options]: Optional object containing any of the following properties:

    • [running]: Indicates the working status of all queues. Default value: true

    • [pauseTime]: Indicates the duration of next pause control. Default value: 1000

Or

  • key: String key names of the above properties (running or pauseTime).

  • value: Value of the above properties (running or pauseTime).

juQueue.get([options])

Parameters:

  • [options]: The object containing of the following properties:

    • [ecb]: Optional error function. Used to catch errors.

    • [list]: Required array of functions. For queue.

e.next([options])

Parameters:

  • [options]: Optional object containing any of the following properties:

    • [step]: The index of the function you want to go directly.

    • [name]: The name of the function you want to go directly.

    • [model]: The object model you want to send to the next function.

    • [args]: The arguments you want to send to the next function.

Examples

Basic Usage

This example shows the most basic way of usage.

License

This software is free to use under the JosephUz. See the LICENSE file for license text and copyright information.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago