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 ca39088 commit ebf86c6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 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 18:37:50'
updated_at: '2024-08-18 20:07:58'
labels:
- 前端
- JS
Expand Down Expand Up @@ -88,7 +88,7 @@ while (true) {

也就是说,更早放入任务队列的任务会优先执行,排在后面的则必须等待前面的任务执行完之后才会开始执行。

### 页面渲染
### 页面渲染呢?

实际情况还有更复杂一些。

Expand Down Expand Up @@ -260,8 +260,8 @@ while (true) {
}

if (isRepaintTime()) {
callbacks = animationFrameCallbacks.splice(0, animationFrameCallbacks.length)
for (callback of callbacks) {
callbacks = animationFrameCallbacks.spliceAll()
for (callback in callbacks) {
execute(callback)
}

Expand All @@ -272,16 +272,16 @@ while (true) {
### 思考题
你有没有担心过,以下代码会“闪一下”
有没有担心过以下代码会“闪”一下
```js
document.body.appendChild(someElement)
someElement.style.display = 'none'
document.body.appendChild(element)
element.style.display = 'none'
```
再比如:
```js
```html
<div id="box" style="width: 100px; height: 100px; background: red"></div>
<button id="btn">Click me</button>

Expand Down

0 comments on commit ebf86c6

Please sign in to comment.