侦听HTML呈现过程事件
Listen for HTML rendering process events
我正在阅读一些关于渲染过程的文章:
https://developers.google.com/web/fundamentals/performance/http://www.sitepoint.com/optimizing-critical-rendering-path/
我希望能够倾听渲染过程中发生的步骤事件,能够知道浏览器何时开始(和完成)处理HTML文档,何时将css规则添加到CSSOM树,。。。
事实上,我正在寻找显示在devtools时间线中的信息,但以正式的格式。
我不认为有一个标准化的模型,但可能有一些浏览器允许监听这些事件。
您只需使用Navigation Timing API的readonly属性,IDL接口:
interface PerformanceTiming {
readonly attribute unsigned long long navigationStart;
readonly attribute unsigned long long unloadEventStart;
readonly attribute unsigned long long unloadEventEnd;
readonly attribute unsigned long long redirectStart;
readonly attribute unsigned long long redirectEnd;
readonly attribute unsigned long long fetchStart;
readonly attribute unsigned long long domainLookupStart;
readonly attribute unsigned long long domainLookupEnd;
readonly attribute unsigned long long connectStart;
readonly attribute unsigned long long connectEnd;
readonly attribute unsigned long long secureConnectionStart;
readonly attribute unsigned long long requestStart;
readonly attribute unsigned long long responseStart;
readonly attribute unsigned long long responseEnd;
readonly attribute unsigned long long domLoading;
readonly attribute unsigned long long domInteractive;
readonly attribute unsigned long long domContentLoadedEventStart;
readonly attribute unsigned long long domContentLoadedEventEnd;
readonly attribute unsigned long long domComplete;
readonly attribute unsigned long long loadEventStart;
readonly attribute unsigned long long loadEventEnd;
};
它来自MDN的完整描述。
但是你听不到performance.timing
对象的变化。
相关文章:
- 为effect Composer创建GodRays效果过程
- 分派点击事件并保留击键修饰符
- 模糊事件的Javascript测试
- keyup事件处理程序更改焦点不适用于快速键入
- 使用 jQuery 的 .on 函数如何获取事件的原始元素
- 如何使Javascript动态html表及其上的事件
- 使用类从一个标记中双击事件
- 如何在未直接触发的情况下停止事件
- 如何在elfinder插件(一个文件管理器插件)上获得上传前事件
- 侦听HTML呈现过程事件
- 在拖动过程中释放鼠标时忽略 JavaScript mouseUp 事件
- 提交过程中的“消防按钮”点击事件
- 从另一个事件(或函数)跳过ajax(或任何其他过程)
- 为什么一个html元素's的onmouseup事件在拖放过程中未触发
- 是在Magento的单页签出过程中触发的JavaScript事件
- Snap SVG:在动画过程中暂停事件侦听器
- JavaScript事件和删除过程后的奇怪行为
- 在HTML5原生拖动过程中检测keydown/up事件
- 在传播过程中修改事件数据
- 在调整大小的过程中,jQuery resize事件会被调用很多次