JavaScript Event Loop: Queue vs Message Queue vs Event Queue

后端 未结 1 1686
面向向阳花
面向向阳花 2021-02-04 10:57

Reading through a lot of JavaScript Event Loop tutorials, I see different terms to identify the queue stores messages ready to be fetched by the Event Loop when the Call Stack i

相关标签:
1条回答
  • 2021-02-04 11:38

    Good question, I'm also a advocate of using proper terminology.

    Queue, message queue, and event queue are referring to the same construct (event loop queue). This construct has the callbacks which are fired in the event loop.

    Interestingly there are two different queues the job queue and the event loop queue. The job queue is specifically designed for promises. The job queue has a higher priority than the event loop queue, so if there are both callbacks available in both queues the ones in the job queue will be put on the stack first.

    Hopefully this answers your question.

    0 讨论(0)
提交回复
热议问题