This package has been deprecated

Author message:

no longer developing here. i keep improving at jueue. browse jueue in npmjs.

juqueue

1.0.4 • Public • Published

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

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.

Package Sidebar

Install

npm i juqueue

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

7.2 kB

Total Files

4

Last publish

Collaborators

  • josephuz