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

queueMicrotask & EventLoop & macrotask & microtask All In One

queueMicrotask & EventLoop & macrotask & microtask All In One

queueMicrotask

scope.queueMicrotask(function);


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"));
    });
  }
};

deno.js

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

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

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

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

宏任务 task & 微任务 microtask

macrotask & microtask

https://javascript.info/event-loop

https://javascript.info/microtask-queue

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

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

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

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

Event loops 秒懂

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

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

refs



©xgqfrms 2012-2021

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

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(210)  评论(10编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-06-13 full page screen capture in js
2019-06-13 HTML5 image rotate effect
2019-06-13 Base 64 & URL & blob & FileReader & createObjectURL All In One
2018-06-13 Web cookie All In One
2018-06-13 IP tracker & Error reporter
2018-06-13 Vue 组件库 & vue components
2018-06-13 JSON parse error
点击右上角即可分享
微信分享提示