1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-28 21:32:20 +00:00

Merge pull request #364 from MrErHu/patch-1

update generator-async.md
This commit is contained in:
Ruan YiFeng 2017-04-02 16:02:07 +08:00 committed by GitHub
commit 2fa05853b9

View File

@ -138,7 +138,7 @@ g.next() // { value: undefined, done: true }
Generator 函数可以暂停执行和恢复执行,这是它能封装异步任务的根本原因。除此之外,它还有两个特性,使它可以作为异步编程的完整解决方案:函数体内外的数据交换和错误处理机制。 Generator 函数可以暂停执行和恢复执行,这是它能封装异步任务的根本原因。除此之外,它还有两个特性,使它可以作为异步编程的完整解决方案:函数体内外的数据交换和错误处理机制。
`next`返回值的value属性是 Generator 函数向外输出数据;`next`方法还可以接受参数,向 Generator 函数体内输入数据。 `next`返回值的value属性是 Generator 函数向外输出数据;`next`方法还可以接受参数,向 Generator 函数体内输入数据。
```javascript ```javascript
function* gen(x){ function* gen(x){