0.0.1 • Published 8 years ago
selfAsync v0.0.1
selfAsync
流程控制模块
Installation
$ npm install selfAsync
Example
var selfAsync = require('selfAsync');
var fun0 = function(cb) {
setTimeout(function() {
console.log('this fun0...');
cb(null) //Callback error message
},2000)
};
var fun1 = function(cb) {
setTimeout(function() {
console.log('this fun1...');
cb(null) //Callback error message
},3000)
};
var fun2 = function(cb) {
setTimeout(function() {
console.log('this fun2...');
cb(null) //Callback error message
},5000)
};
async.serise(fun0,fun1, fun2, function(err) {
console.log(err)
console.log('exec ok~')
});
async.parallel(fun0,fun1, fun2, function(err) {
console.log(err)
console.log('exec ok~')
});
=====================================================
var fun0 = function(cb) {
setTimeout(function() {
console.log('this fun0...');
cb(null,'one')
},2000)
};
var fun1 = function(a, cb) {
setTimeout(function() {
console.log('this fun1...');
console.log(a)
cb(null, 'two')
},3000)
};
var fun2 = function(a,cb) {
setTimeout(function() {
console.log('this fun2...');
console.log(a)
cb(null)
},5000)
};
async.waterfall(fun0,fun1, fun2, function(err) {
console.log(err)
console.log('exec ok~')
});
### API
- selfAsync.serise()
- selfAsync.parallel()
- selfAsync.waterfall()
### Contributing
- Fork this Repo first
- Clone your Repo
- Install dependencies by `$ npm install`
- Checkout a feature branch
- Feel free to add your features
- Make sure your features are fully tested
- Publish your local branch, Open a pull request
- Enjoy hacking <3
### ISC license
Copyright (c) 2016 baiguangan
---
![docor]()
built upon love by [docor](https://github.com/turingou/docor.git) v0.3.0