mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-25 03:02:21 +00:00
Merge branch 'gh-pages' of github.com:ruanyf/es6tutorial into gh-pages
This commit is contained in:
commit
c25565b70c
@ -98,7 +98,7 @@ Promise 的最大问题是代码冗余,原来的任务被Promise 包装了一
|
|||||||
举例来说,读取文件的协程写法如下。
|
举例来说,读取文件的协程写法如下。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function *asnycJob() {
|
function *asyncJob() {
|
||||||
// ...其他代码
|
// ...其他代码
|
||||||
var f = yield readFile(fileA);
|
var f = yield readFile(fileA);
|
||||||
// ...其他代码
|
// ...其他代码
|
||||||
@ -1171,7 +1171,7 @@ function chainAnimationsPromise(elem, animations) {
|
|||||||
var p = Promise.resolve();
|
var p = Promise.resolve();
|
||||||
|
|
||||||
// 使用then方法,添加所有动画
|
// 使用then方法,添加所有动画
|
||||||
for(var anim in animations) {
|
for(var anim of animations) {
|
||||||
p = p.then(function(val) {
|
p = p.then(function(val) {
|
||||||
ret = val;
|
ret = val;
|
||||||
return anim(elem);
|
return anim(elem);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user