mutationObserver 可以监听节点为的变化
const oTarget = document.getElementById('app');
function cb (mutationList, observer) {
console.log(mutationList, observer);
}
const observer = new MutationObserver(cb);
observer.observe(oTarget, {
attrributes: true,
childList: true,
subtree: true
});
process.nextTick 是 nodeJS 的方法
Promise.resolve().then(() => {
console.log('Promise');
});
setTimeout(() => {
console.log('setTimeout'), 0)
});
process.nextTick(() => {
console.log('nextTick');
});
// nextTick
// Promise
// setTimeout
作为微任务优先于 Promise 的运行