jueue
For proper coding and to run sequential asynchronous function.
Installation
$ npm install jueue
Usage
var jueue = require('jueue');
jueue.set({
running: true,
pauseTime: 1000
});
jueue.set("running", true);
jueue.set("pauseTime", 1000);
jueue.get(
function (e) {
e.next();
},
function (e) {
e.throw(error);
e.done();
}
).then(function (result) {
}).catch(function(err) {
});
var jueue = require('jueue');
jueue.get(
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
jueue.set([options])
or jueue.set(key, value)
Parameters:
Or
jueue.get(list)
or jueue.get()
Parameters:
[list]
: Required array of functions. For queue.
Or
[arguments]
: list may write like arguments.
jueue.promise(list)
or jueue.promise()
Used to get instance of promise for jueue.
Parameters:
[list]
: Required array of functions. For queue.
Or
[arguments]
: list may write like arguments.
jueue.catch(ecb)
Parameters:
ecb
: Optional error function. Used to catch errors.
jueue.then(cb)
Parameters:
cb
: Optional done function. Used to catch done.
e.next([options])
or e.next(step)
or e.next(name)
Parameters:
Or
step
: The index of the function you want to go directly. options may write like step.
Or
name
: The name of the function you want to go directly. options may write like name.
e.throw(err)
Parameters:
err
: It must be instance of Error.
e.done(result)
Parameters:
result
: Object that you want to send.
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.