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) {
|
2024-01-31 10:17:24 +01:00
|
|
|
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
|