NotRestoredReasons: toJSON()-Methode

Limited availability

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

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.

Die toJSON()-Methode der NotRestoredReasons-Schnittstelle ist ein Serializer; sie gibt eine JSON-Darstellung des NotRestoredReasons-Objekts zurück.

Syntax

js
toJSON()

Parameter

Keine.

Rückgabewert

Ein JSON-Objekt, das die Serialisierung des NotRestoredReasons-Objekts ist.

Beispiele

Die folgende Funktion gibt eine JSON-Darstellung des NotRestoredReasons-Objekts des aktuell im Performance-Timeline vorhandenen ersten PerformanceNavigationTiming-Objekts zurück:

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

Spezifikationen

Specification
HTML
# notrestoredreasons

Browser-Kompatibilität

Siehe auch