美文网首页
JS事件循环机制Event Loop

JS事件循环机制Event Loop

作者: 林几许 | 来源:发表于2022-02-22 17:05 被阅读0次

    执行顺序

    微任务——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