Skip to content

Commit

Permalink
docs: 更新文档高亮 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 authored Jun 15, 2020
1 parent ff5c1b9 commit 9e40c08
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ asyncFlow.subscribe(context => {
`buildFlow` 的第二个参数是 flowConfig 对象时. 这个对象的每一项都会并行执行.
所以相邻的异步逻辑无法获取其他异步逻辑的结果. 并行定义 flow 时,flowConfig 哈希的每一项的 key 必须和 flowConfig 的 name 一致,否则会报错.

```
```JavaScript
// 在线预览地址(将 index 文件替换为此文件): https://stackblitz.com/edit/ypzuhr-lkli1h?file=parallel_flow.ts
import { buildFlow } from "@tomyail/async-flow";
// basic usage
Expand Down Expand Up @@ -172,8 +172,7 @@ asyncFlow.subscribe(context => {

每个 flowConfig 可以定义 children 属性,其类型可以是数组或者flowConfig 哈希.在其父异步逻辑执行完毕后,将会执行 children flow.

```
```JavaScript
// 在线预览地址(将 index 文件替换为此文件): https://stackblitz.com/edit/ypzuhr-lkli1h?file=children_flow.ts
import { buildFlow } from "@tomyail/async-flow";
// basic usage
Expand Down Expand Up @@ -248,8 +247,8 @@ asyncFlow.subscribe(context => {


flowConfig 里面的 flow 的返回值不仅仅可以是 promise,它还可以是其他 [Observable](https://rxjs-dev.firebaseapp.com/guide/observable). 由于 buildFlow 本身就会产生一个 Observable,所以可以嵌套使用. 嵌套使用的时候 context 不会被打平.
```

```JavaScript
// 在线预览地址(将 index 文件替换为此文件): https://stackblitz.com/edit/ypzuhr-lkli1h?file=nest_flow.ts
import { buildFlow } from "@tomyail/async-flow";

Expand Down Expand Up @@ -294,6 +293,5 @@ asyncFlow.subscribe(context => {
// parentFlowConfig2: 2;
// }
});
```

0 comments on commit 9e40c08

Please sign in to comment.