Skip to content

Commit 9a20b45

Browse files
authored
Rename resourceLoadTime to resourceLoadDuration (#450)
1 parent be20a19 commit 9a20b45

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ interface LCPAttribution {
993993
* otherwise 0). See [Optimize LCP](https://web.dev/articles/optimize-lcp) for
994994
* details.
995995
*/
996-
resourceLoadTime: number;
996+
resourceLoadDuration: number;
997997
/**
998998
* The delta between when the LCP resource finishes loading until the LCP
999999
* element is fully rendered. See [Optimize

src/attribution/onLCP.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const attributeLCP = (metric: LCPMetric) => {
6262
element: getSelector(lcpEntry.element),
6363
timeToFirstByte: ttfb,
6464
resourceLoadDelay: lcpRequestStart - ttfb,
65-
resourceLoadTime: lcpResponseEnd - lcpRequestStart,
65+
resourceLoadDuration: lcpResponseEnd - lcpRequestStart,
6666
elementRenderDelay: lcpRenderTime - lcpResponseEnd,
6767
navigationEntry,
6868
lcpEntry,
@@ -84,7 +84,7 @@ const attributeLCP = (metric: LCPMetric) => {
8484
(metric as LCPMetricWithAttribution).attribution = {
8585
timeToFirstByte: 0,
8686
resourceLoadDelay: 0,
87-
resourceLoadTime: 0,
87+
resourceLoadDuration: 0,
8888
elementRenderDelay: metric.value,
8989
};
9090
};

src/types/lcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface LCPAttribution {
5656
* otherwise 0). See [Optimize LCP](https://web.dev/articles/optimize-lcp) for
5757
* details.
5858
*/
59-
resourceLoadTime: number;
59+
resourceLoadDuration: number;
6060
/**
6161
* The delta between when the LCP resource finishes loading until the LCP
6262
* element is fully rendered. See [Optimize

test/e2e/onLCP-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ describe('onLCP()', async function () {
457457
assert.equal(
458458
lcp.attribution.timeToFirstByte +
459459
lcp.attribution.resourceLoadDelay +
460-
lcp.attribution.resourceLoadTime +
460+
lcp.attribution.resourceLoadDuration +
461461
lcp.attribution.elementRenderDelay,
462462
lcp.value,
463463
);
@@ -514,7 +514,7 @@ describe('onLCP()', async function () {
514514
assert.equal(
515515
lcp.attribution.timeToFirstByte +
516516
lcp.attribution.resourceLoadDelay +
517-
lcp.attribution.resourceLoadTime +
517+
lcp.attribution.resourceLoadDuration +
518518
lcp.attribution.elementRenderDelay,
519519
lcp.value,
520520
);
@@ -568,7 +568,7 @@ describe('onLCP()', async function () {
568568
);
569569

570570
assert.equal(
571-
lcp.attribution.resourceLoadTime,
571+
lcp.attribution.resourceLoadDuration,
572572
Math.max(0, lcpResEntry.responseEnd - navEntry.activationStart) -
573573
Math.max(0, lcpResEntry.requestStart - navEntry.activationStart),
574574
);
@@ -583,7 +583,7 @@ describe('onLCP()', async function () {
583583
assert.equal(
584584
lcp.attribution.timeToFirstByte +
585585
lcp.attribution.resourceLoadDelay +
586-
lcp.attribution.resourceLoadTime +
586+
lcp.attribution.resourceLoadDuration +
587587
lcp.attribution.elementRenderDelay,
588588
lcp.value,
589589
);
@@ -614,11 +614,11 @@ describe('onLCP()', async function () {
614614
assert.equal(lcp.attribution.url, undefined);
615615
assert.equal(lcp.attribution.element, 'html>body>main>h1');
616616
assert.equal(lcp.attribution.resourceLoadDelay, 0);
617-
assert.equal(lcp.attribution.resourceLoadTime, 0);
617+
assert.equal(lcp.attribution.resourceLoadDuration, 0);
618618
assert.equal(
619619
lcp.attribution.timeToFirstByte +
620620
lcp.attribution.resourceLoadDelay +
621-
lcp.attribution.resourceLoadTime +
621+
lcp.attribution.resourceLoadDuration +
622622
lcp.attribution.elementRenderDelay,
623623
lcp.value,
624624
);
@@ -664,7 +664,7 @@ describe('onLCP()', async function () {
664664
assert.equal(lcp2.attribution.element, undefined);
665665
assert.equal(lcp2.attribution.timeToFirstByte, 0);
666666
assert.equal(lcp2.attribution.resourceLoadDelay, 0);
667-
assert.equal(lcp2.attribution.resourceLoadTime, 0);
667+
assert.equal(lcp2.attribution.resourceLoadDuration, 0);
668668
assert.equal(lcp2.attribution.elementRenderDelay, lcp2.value);
669669
assert.equal(lcp2.attribution.navigationEntry, undefined);
670670
assert.equal(lcp2.attribution.lcpResourceEntry, undefined);

0 commit comments

Comments
 (0)