2021-04-22 22:05:29 -07:00
|
|
|
import { ReportHandler } from "web-vitals";
|
2021-04-22 12:16:15 -07:00
|
|
|
|
|
|
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
|
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
2021-04-22 22:05:29 -07:00
|
|
|
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
2021-04-22 12:16:15 -07:00
|
|
|
getCLS(onPerfEntry);
|
|
|
|
getFID(onPerfEntry);
|
|
|
|
getFCP(onPerfEntry);
|
|
|
|
getLCP(onPerfEntry);
|
|
|
|
getTTFB(onPerfEntry);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default reportWebVitals;
|