cra-template-conpec-1.8.1
Version:
Template conpec
22 lines (19 loc) • 465 B
text/typescript
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler): void => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({
getCLS,
getFCP,
getFID,
getLCP,
getTTFB
}) => {
getCLS(onPerfEntry);
getFCP(onPerfEntry);
getFID(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;