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

浏览器兼容性

另见