mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
修改Generator函数为习惯写法
This commit is contained in:
parent
4f3d176b3d
commit
c01d5867b7
@ -102,7 +102,7 @@ Promise 的最大问题是代码冗余,原来的任务被 Promise 包装了一
|
|||||||
举例来说,读取文件的协程写法如下。
|
举例来说,读取文件的协程写法如下。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function *asyncJob() {
|
function* asyncJob() {
|
||||||
// ...其他代码
|
// ...其他代码
|
||||||
var f = yield readFile(fileA);
|
var f = yield readFile(fileA);
|
||||||
// ...其他代码
|
// ...其他代码
|
||||||
|
Loading…
x
Reference in New Issue
Block a user