xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

queueMicrotask

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask

scope.queueMicrotask(function);

https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing


self.queueMicrotask(() => {
  // function contents here
})


MyElement.prototype.loadData = function (url) {
  if (this._cache[url]) {
    queueMicrotask(() => {
      this._setData(this._cache[url]);
      this.dispatchEvent(new Event("load"));
    });
  } else {
    fetch(url).then(res => res.arrayBuffer()).then(data => {
      this._cache[url] = data;
      this._setData(data);
      this.dispatchEvent(new Event("load"));
    });
  }
};

https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide


macrotask & microtask

https://javascript.info/event-loop

https://zh.javascript.info/event-loop


浅析JS堆、栈、执行栈 和 EventLoop

https://mp.weixin.qq.com/s/Vydvo1PVGgr9zGbYsubX5w

Event loops 秒懂

https://github.com/wangmeijian/blog/blob/master/docs/Event loops秒懂.md

宏任务 task & 微任务 microtask

https://zh.javascript.info/event-loop

https://zh.javascript.info/microtask-queue

critical-rendering-path

前端性能优化

https://developers.google.com/web/fundamentals/performance/critical-rendering-path/render-tree-construction

https://developers.google.com/web/fundamentals/performance/critical-rendering-path/constructing-the-object-model?hl=zh-cn


Flag Counter

©xgqfrms 2012-2020

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


原文地址:https://www.cnblogs.com/xgqfrms/p/13112261.html