PerformanceEventTiming: thuộc tính processingStart

Baseline 2025
Newly available

Since December 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Thuộc tính chỉ đọc processingStart trả về thời điểm bắt đầu gửi sự kiện. Đây là lúc các trình xử lý sự kiện sắp được thực thi.

Giá trị

Dấu thời gian DOMHighResTimeStamp.

Ví dụ

Sử dụng thuộc tính processingStart

Thuộc tính processingStart có thể được sử dụng khi quan sát các mục event timing (PerformanceEventTiming). Ví dụ, để tính toán độ trễ đầu vào hoặc thời gian xử lý sự kiện.

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

Thông số kỹ thuật

Thông số kỹ thuật
Event Timing API
# dom-performanceeventtiming-processingstart

Tương thích trình duyệt

Xem thêm