queueMicrotask & Promise All In One


queueMicrotask & Promise All In One

微任务


setTimeout(() => {
  console.log("timer");
  queueMicrotask(() => {
    console.log("microtask in timer");
  });
}, 0);

queueMicrotask(() => {
  console.log("microtask");
});


/*

microtask
timer
microtask in timer

*/





refs


Flag Counter

?xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有??xgqfrms, 禁止转载 ???,侵权必究??!