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 18, 2024
1 parent 6fd0cdd commit b716ff9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion 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 20:07:58'
updated_at: '2024-08-18 23:17:41'
labels:
- 前端
- JS
Expand Down Expand Up @@ -309,6 +309,17 @@ element.style.display = 'none'
原因:上述点击事件产生一个 task(事件回调),只有执行完 task 里面的代码,才有可能进入渲染流程。也就是说渲染之前,实际只有最后一行的样式设置是起作用的,不管你中间设了多少遍,浏览器只关心最后的样式如何。
## Node.js 又是怎样的呢?
相比之下,Node.js 的 Event Loop 会简单一些。
- 没有 \<script> 解析
- 没有用户交互
- 没有 requestAnimationFrame
- 没有 DOM 渲染
未完待续...
## References
- [Event loops spec](https://html.spec.whatwg.org/multipage/webappapis.html#event-loops)

0 comments on commit b716ff9

Please sign in to comment.