宏任务和微任务

39 阅读1分钟

宏任务

1.新程序或子程序被直接执行

2.事件的回调函数

3.setTimeout()和setInterval()

4.requetAnimationFrame

5.I/O操作

6.setlmmediate

7.UI rendering

微任务

1.Promise .then() .catch() .finally() async...await

2.MutationObserver

3.Object.observe

4.process.nextTick()

cpu 1179 主板 1109