执行顺序
微任务——DOM渲染——宏任务
微任务
Promise.then
Object.observe
MutationObserver
process.nextTick(Node.js 环境)
宏任务
script(整体代码)
setTimeout
setInterval
I/O
UI交互事件
postMessage
MessageChannel
setImmediate(Node.js 环境)
微任务——DOM渲染——宏任务
Promise.then
Object.observe
MutationObserver
process.nextTick(Node.js 环境)
script(整体代码)
setTimeout
setInterval
I/O
UI交互事件
postMessage
MessageChannel
setImmediate(Node.js 环境)
本文标题:JS事件循环机制Event Loop
本文链接:https://www.haomeiwen.com/subject/ftiglrtx.html
网友评论