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 |
瀏覽器相容性
載入中…