2021-06-12 14:51:22 +07:00
|
|
|
import { ReportHandler } from 'web-vitals'
|
2021-06-12 14:10:52 +07:00
|
|
|
|
|
|
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
|
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
|
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
2021-06-12 14:51:22 +07:00
|
|
|
getCLS(onPerfEntry)
|
|
|
|
getFID(onPerfEntry)
|
|
|
|
getFCP(onPerfEntry)
|
|
|
|
getLCP(onPerfEntry)
|
|
|
|
getTTFB(onPerfEntry)
|
|
|
|
})
|
2021-06-12 14:10:52 +07:00
|
|
|
}
|
2021-06-12 14:51:22 +07:00
|
|
|
}
|
2021-06-12 14:10:52 +07:00
|
|
|
|
2021-06-12 14:51:22 +07:00
|
|
|
export default reportWebVitals
|