datahub/datahub-web-react/src/reportWebVitals.ts
John Joyce 550cdc51ee
feat(React Incubation): React Playground Proof of Concept (#2059)
Co-authored-by: John Joyce <jjoyce0510@gmail.com>
2021-01-17 12:54:49 -08:00

16 lines
473 B
TypeScript

import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler): void => {
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;