INNER CODE UNIT · JavaScript
parsePage
cyrus-and/chrome-har-capturer · lib/har.js:31
function parsePage(pageId, stats) {
// page load started at
const firstRequest = stats.entries.get(stats.firstRequestId).requestParams;
const wallTimeMs = firstRequest.wallTime * 1000;
const startedDateTime = new Date(wallTimeMs).toISOString();
// page timings
const onContentLoad = stats.domContentEventFiredMs - stats.firstRequestMs;
const onLoad = stats.loadEventFiredMs - stats.firstRequestMs;
// process this page load entries
const entries = [...stats.entries.values()]
.map((entry) => parseEntry(pageId, entry))
.filter((entry) => entry);
// outcome
return {
page: {
id: pageId,
title: stats.url,
startedDateTime,