- JavaScript 运行机制详解:再谈Event Loop
- Macrotask 与 Microtask 核心概念
- 这一次,彻底弄懂 JavaScript 执行机制
- Nodejs 解读event loop的事件处理机制
- Node.js 代码阅读笔记系列 — process.nextTick() 的实现
- node,setImmeidate, setTimeout, nextTick你真的了解么?
console.log('main1');
setTimeout(function() {
console.log('setTimeout');
process.nextTick(function() {
console.log('process.nextTick2');
});
}, 0);
new Promise(function(resolve, reject) {
console.log('promise');
resolve();
}).then(function() {
console.log('promise then');
});
process.nextTick(function() {
console.log('process.nextTick1');
});
console.log('main2');