clipper/frontend/src/reportWebVitals.ts

16 lines
431 B
TypeScript
Raw Normal View History

2021-09-06 10:17:50 +00:00
import { ReportHandler } from 'web-vitals';
2021-09-30 19:08:48 +00:00
const reportWebVitals = (onPerfEntry?: ReportHandler): void => {
2021-09-06 10:17:50 +00:00
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;