1.1.4 • Published 5 years ago

asynchronous-flow v1.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Installation

npm install asynchronous-flow

Usage

Import

var flow = require('asynchronous-flow');

Instantiate

var asyncSeries = new flow();

Additional Config

asyncSeries.setArgs(/*args*/)
	.setErrorHandler(/*handler function*/);

setArgs

Set the arguments passed through every function. Can passed multiple arguments.

setErrorHandler

Set the handler function to handle error thrown by next(err).

Asynchronous Function

The last argument of target function must be a function next.(Similar to Express)

Example

var flow = require('asynchronous-flow');

function func1(arg, next){
	console.log(arg.val++);
	next();
}

function func2(arg, next){
	console.log(arg.val++);
	next('error test');
}

var args = {val: 0};

var tmp = new flow();
tmp.setArgs(args)
	.setErrorHandler((err) => {console.log('Error : ', err)})
	.flow(func1, func2, (arg) => {
		console.log(arg.val);
	});
1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago