Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1dfe00e

Browse files
committed
deps: upgraded deps
1 parent 1ecd4e1 commit 1dfe00e

File tree

4 files changed

+605
-100
lines changed

4 files changed

+605
-100
lines changed

‎03-2-async-test.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Async 小测验
2+
========
3+
4+
Async Function 同样会有一些令人困惑的地方,我收集了一些,放在这里方便大家学习。
5+
6+
1. 执行顺序
7+
8+
> 来自 [Axel Rauschmayer](https://twitter.com/rauschma/status/1188927319685120001)
9+
10+
下面两行代码的执行顺序一致么?不一致的话,差别在哪里?
11+
12+
```js
13+
/* 1 */ [one, two] = [await fn(1), await fn(2)];
14+
/* 2 */ [one, two] = await Promise.all([fn(1), fn(2)]);
15+
```
16+
17+
**答案:**
18+
19+
不一致。(1) 是顺序执行,因为构建数组时,会先等待 `fn(1)``fn(2)` 执行完;(2) 是并发执行,`fn(2)` 会在 `fn(1)` 执行完但是没有返回结果时立即执行。
20+
21+
--------
22+
23+
总结
24+
--------
25+
26+
其实说起来是 Async 问题,其实都是语法问题。

‎SUMMARY.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [Promise 进阶](02-04-promise-advanced.md)
1313
* [Async Functions 方案](03-async-function.md)
1414
* [Async Functions VS Promise](03-1-async-function-vs-promise.md)
15+
* [Async 小测验](03-2-async-test.md)
1516
* [一起实战吧](04-lets-do-it.md)
1617
* [降级](04-1-downgrade.md)
1718
* [小程序](04-2-xiaochengxu.md)
@@ -23,4 +24,4 @@
2324

2425
* [反馈意见](https://github.com/meathill/javascript-async-tutorial/issues)
2526
* [更新记录](CHANGELOG.md)
26-
* [待增补内容](TODO.md)
27+
* [待增补内容](TODO.md)

‎TODO.md‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,3 @@
22
========
33

44
这里主要放日常看到,但暂时写不进去的内容。
5-
6-
## Vue 2.4
7-
8-
[更新日志](https://github.com/vuejs/vue/releases/tag/v2.4.0)中写到:
9-
10-
* Full SSR + async component support in core: SSR now supports rendering async components used anywhere and the client also supports async components during the hydration phase. This means async components / code-splitting now just works during SSR and is no longer limited at the route level.
11-
12-
看看是不是合适加进去。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /