image src & read more at:
https://developers.google.com/web/fundamentals/performance/rail
image src & read more at:
https://www.w3.org/TR/navigation-timing
image src & read more at:
https://www.w3.org/TR/navigation-timing-2/
const [perfData] = performance.getEntriesByType('navigation');
const pageLoadTime = perfData.loadEventEnd
- perfData.startTime;
const dnsLookupTime = perfData.domainLookupEnd
- perfData.domainLookupStart;
const timeTillFirstByte = perfData.responseStart
- perfData.requestStart;
read more at:
https://www.w3.org/TR/navigation-timing-2/
// retrieving script transfer size
const scriptsResources = performance.getEntriesByType('resource')
.filter(entry => entry.initiatorType === 'script');
const scriptsTransferSize = scriptsResources
.reduce((sum, {transferSize}) => sum + transferSize, 0);
image src & read more at:
https://developers.google.com/web/fundamentals/performance/rail
// first-paint, first-contentful-paint
const timingEntries = performance.getEntriesByType('paint');
const observer = new PerformanceObserver(list => {
const entries = list.getEntries();
// log performance data
});
observer.observe({entryTypes: ["resource"]});
@RafalRumanek