Which types of queues are in event loop?

前端 未结 3 1923
走了就别回头了
走了就别回头了 2021-01-14 14:10

I am faced with the mention of render queue in different articles (example, example) Both authors say that

render callback is given the

3条回答
  •  -上瘾入骨i
    2021-01-14 14:36

    I think that is incorrect, unless I have misunderstood. This is my current source of information.

    "Immediately after every macrotask, the engine executes all tasks from microtask queue, prior to running any other macrotasks or rendering or anything else."

    https://javascript.info/event-loop

    The below is an experiment which didn't behave in my code snippet, but it demonstrates that the microtrask from the .then inside button_one() take priority over the render change on the button. You can see from the console output of "button one out" that the microtask is after the button function.

    
    
        
        
    
    
    
    
    

提交回复
热议问题