const observer = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
entry.serverTiming.forEach((serverTiming) => {
const json = serverTiming.toJSON();
console.log(json); // A plain object
console.log(typeof json); // "object"
console.log(json.name); // Same value as serverTiming.name
});
});
});
["navigation", "resource"].forEach((type) =>
observer.observe({ type, buffered: true }),
);PerformanceServerTiming: toJSON() method / notebook
PerformanceServerTiming: toJSON() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
console.log(JSON.stringify(serverTiming));