MDN self-hosted library · e01.org

PerformanceTimingConfidence: toJSON() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const observer = new PerformanceObserver((list) => {
  list.getEntries().forEach((entry) => {
    const confidence = entry.confidence;

    const json = confidence.toJSON();
    console.log(json); // A plain object
    console.log(typeof json); // "object"
    console.log(json.value); // Same value as confidence.value
  });
});

observer.observe({ type: "navigation", buffered: true });
js
console.log(JSON.stringify(confidence));