Skip to content

Commit

Permalink
feat: lcp uses startTime
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney committed Apr 18, 2024
1 parent 753d008 commit 17977f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ sampleRUM.drain('cwv', (() => {

registerPerformanceObserver('largest-contentful-paint', (entries) => {
const entry = entries.pop();
storeCWV({ name: 'LCP', value: entry.renderTime, entries: [entry] });
storeCWV({ name: 'LCP', value: entry.startTime, entries: [entry] });
});

registerPerformanceObserver('navigation', (entries) => {
Expand All @@ -122,7 +122,7 @@ sampleRUM.drain('cwv', (() => {

// When loading `web-vitals` using a classic script, all the public
// methods can be found on the `webVitals` global namespace.
['FID', 'INP', 'TTFB', 'CLS'].forEach((metric) => {
['FID', 'INP', 'CLS'].forEach((metric) => {
const metricFn = window.webVitals[`on${metric}`];
if (typeof metricFn === 'function') {
const opts = isEager(metric) ? { reportAllChanges: featureToggle() } : undefined;
Expand Down

0 comments on commit 17977f8

Please sign in to comment.