Skip to content

Commit

Permalink
docs: update issue 348
Browse files Browse the repository at this point in the history
  • Loading branch information
toFrankie committed Aug 17, 2024
1 parent be9005d commit ba3d692
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions archives/2024/348.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 通过两个例子再探 Event Loop
number: '#348'
link: 'https://github.com/toFrankie/blog/issues/348'
created_at: '2024-08-11 16:42:16'
updated_at: '2024-08-18 01:01:39'
updated_at: '2024-08-18 01:07:53'
labels:
- 前端
- JS
Expand Down Expand Up @@ -133,7 +133,9 @@ while (true) {

完了,推翻了前面的结论,啪啪打脸 🤦

其实不一定,如果我们只是想要理解 Event Loop 主要执行顺序的话,不深入了解浏览器究竟维护了多少个(种)任务队列、浏览器是如何决定下一任务的,那么可以简单的理解成:Event Loop 有一个任务队列,队列是按照先进先出的顺序执行,只不过它实际由浏览器决定,将其选好的任务按序放到我们理解的任务队列里而已([了解更多](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model))。
其实不一定,如果你只想了解 Event Loop 主要执行顺序,不深入浏览器究竟维护了多少个任务队列、浏览器如何决定下一任务,那么简单地理解为这样也是没有问题的:Event Loop 只有一个任务队列,队列仍是按照先进先出的顺序执行,只不过它实际由浏览器决定,将其按序放入我们所理解的“任务队列”里面而已。

> 想了解更多请看 [Processing model](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model)
Event Loop 现在是这样的:

Expand Down

0 comments on commit ba3d692

Please sign in to comment.