javascript - Nodejs 消息队列 vs 宏任务队列

标签 javascript node.js

消息队列宏任务队列有什么区别?是一样的吗?

关于 Nodejs 文档 here它说:

When setTimeout() is called, the Browser or Node.js starts the timer. Once the timer expires, in this case immediately as we put 0 as the timeout, the callback function is put in the Message Queue.

同时,在 this部分,它说:

A setTimeout, setImmediate callback is added to macrotask queue

那么,消息队列宏任务队列是一回事吗?

最佳答案

这里指的是同一个东西。可以说“message queue”是一个更通用的术语,如“微任务队列和宏任务队列都是消息队列”。

关于javascript - Nodejs 消息队列 vs 宏任务队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72643483/

相关文章:

javascript - Snap.svg 中的 mask 问题

javascript - Mongo聚合管道更新或推送

node.js - npm 不支持 Node.js v8.17.0

javascript - 在 javascript 中使用反射来获取失败时测试函数的名称

javascript - Django、Dajax 和 Javascript - onclick 不调用 python 方法

javascript - 商店和模型有什么区别?

javascript - WebSQL 事务不会在 JS 回调函数中运行

javascript - 如何使用js从特定链接获取值(value)?

android - 非 Root Android 上的 Node.js

javascript - JSON 响应未在 Angularjs View 中显示