Files
modeling-app/src/reportWebVitals.ts

18 lines
471 B
TypeScript
Raw Normal View History

2022-11-26 08:34:23 +11:00
import { ReportHandler } from 'web-vitals'
2022-11-12 13:11:54 +11:00
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)
})
.catch((e) => console.log(e))
2022-11-12 13:11:54 +11:00
}
2022-11-26 08:34:23 +11:00
}
2022-11-12 13:11:54 +11:00
2022-11-26 08:34:23 +11:00
export default reportWebVitals