Skip to content

Commit

Permalink
Update web-vitals calls
Browse files Browse the repository at this point in the history
The `getXXX()` functions of the `web-vitals` library were renamed in
3.0.0 to `onXXX()` [1]. Fix our calls to reflect this.

[1]: GoogleChrome/web-vitals#222
  • Loading branch information
mgrabovsky committed Nov 18, 2022
1 parent e139160 commit dae3d37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { ReportHandler } from 'web-vitals';

export const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => {
onCLS(onPerfEntry);
onFID(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
});
}
};

0 comments on commit dae3d37

Please sign in to comment.