NotRestoredReasonDetails: phương thức toJSON()

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Phương thức toJSON() của giao diện NotRestoredReasonDetails là một bộ tuần tự hóa; nó trả về biểu diễn JSON của đối tượng NotRestoredReasonDetails.

Cú pháp

js
toJSON()

Tham số

Không có.

Giá trị trả về

Một đối tượng JSON là bản tuần tự hóa của đối tượng NotRestoredReasonDetails.

Ví dụ

Hàm sau đây sẽ trả về biểu diễn JSON của đối tượng NotRestoredReasonDetails đầu tiên của đối tượng NotRestoredReasons từ đối tượng PerformanceNavigationTiming đầu tiên hiện có trong timeline hiệu suất:

js
function returnNRR() {
  const navEntries = performance.getEntriesByType("navigation");
  let navEntry = navEntries[0];
  return navEntry.notRestoredReasons.reasons[0].toJSON();
}

Thông số kỹ thuật

Thông số kỹ thuật
HTML
# notrestoredreasondetails

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

Xem thêm