NotRestoredReasons: toJSON() method

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 NotRestoredReasons là một bộ tuần tự hóa; nó trả về biểu diễn JSON của đối tượng NotRestoredReasons.

Cú pháp

js
toJSON()

Tham số

Không có.

Giá trị trả về

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

Ví dụ

Hàm sau sẽ trả về biểu diễn JSON của đối tượng NotRestoredReasons của PerformanceNavigationTiming đầu tiên hiện có trong dòng thời gian hiệu suất:

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

Thông số kỹ thuật

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

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

Xem thêm