reportWebVitals.ts 425 B

123456789101112131415
  1. import { ReportHandler } from 'web-vitals';
  2. const reportWebVitals = (onPerfEntry?: ReportHandler) => {
  3. if (onPerfEntry && onPerfEntry instanceof Function) {
  4. import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
  5. getCLS(onPerfEntry);
  6. getFID(onPerfEntry);
  7. getFCP(onPerfEntry);
  8. getLCP(onPerfEntry);
  9. getTTFB(onPerfEntry);
  10. });
  11. }
  12. };
  13. export default reportWebVitals;