Skip to content

Commit

Permalink
~ 更新 readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Jan 23, 2017
1 parent 66dac3f commit 64363f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 71 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "blear.utils.plan",
"version": "2.1.0",
"description": "(同步、异步)任务计划(流程控制)",
"version": "2.1.1",
"description": "(同步、异步、promise)任务计划(流程控制)",
"scripts": {
"live": "browser-sync start --config bs-config.js",
"test": "node ./node_modules/.bin/karma start karma.conf.js --single-run",
Expand Down
71 changes: 2 additions & 69 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# blear.utils.plan

<https://blear.ydr.me/utils/plan>

[![npm module][npm-img]][npm-url]
[![build status][travis-img]][travis-url]
[![coverage][coveralls-img]][coveralls-url]
Expand All @@ -12,72 +14,3 @@

[coveralls-img]: https://img.shields.io/coveralls/blearjs/blear.utils.plan/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/github/blearjs/blear.utils.plan?branch=master


# 串行
```js
plan
// 异步任务
.task(function (next) {
setTimeout(function () {
next(null, 1);
}, 10);
})
// 同步任务
.taskSync(function (ret) {
// 1 + 2
return ret + 2;
})
// 串行
.serial()
.try(function (ret) {
expect(ret).toBe(3);
done();
});
```

# 并行
```js
plan
// 异步任务
.task(function (next) {
setTimeout(function () {
next(null, 1);
}, 10);
})
// 同步任务
.taskSync(function () {
return 2;
})
// 并行
.parallel()
.try(function (ret1, ret2) {
expect(ret1).toBe(1);
expect(ret2).toBe(2);
done();
});
```

# API
## plan.task
## plan.taskSync
## plan.each
## plan.eachSync
## plan.repeat
## plan.wait
## plan.is
## plan.as
## plan.serial
## plan.parallel
## plan.try
## plan.catch

# Events
## planStart
## planEnd
## planSuccess
## planError
## taskStart
## taskEnd
## taskSuccess
## taskError

0 comments on commit 64363f6

Please sign in to comment.