For proper coding and to run sequential asynchronous function.
$ npm install juqueue
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;
//...
}
]
});
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).
Parameters:
-
[options]
: The object containing of the following properties:-
[ecb]
: Optional error function. Used to catch errors. -
[list]
: Required array of functions. For queue.
-
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.
-
This example shows the most basic way of usage.
This software is free to use under the JosephUz. See the LICENSE file for license text and copyright information.