PerformanceEventTiming: processingEnd 属性
只读的 processingEnd 属性返回最后一个事件处理程序执行完成的时间。
如果没有事件处理程序,它的值等于 PerformanceEventTiming.processingStart。
值
一个 DOMHighResTimeStamp 时间戳。
示例
使用 processingEnd 属性
processingEnd 属性可在观察事件计时条目(PerformanceEventTiming)时使用。例如,用于计算输入延迟或事件处理时间。
js
const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
// Full duration
const duration = entry.duration;
// Input delay (before processing event)
const delay = entry.processingStart - entry.startTime;
// Synchronous event processing time
// (between start and end dispatch)
const time = entry.processingEnd - entry.processingStart;
});
});
// Register the observer for events
observer.observe({ type: "event", buffered: true });
规范
| 规范 |
|---|
| 事件计时 API # dom-performanceeventtiming-processingend |
浏览器兼容性
加载中…