aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-create-react-app/apps/docs/src/reportWebVitals.ts
diff options
context:
space:
mode:
Diffstat (limited to 'examples/with-create-react-app/apps/docs/src/reportWebVitals.ts')
-rw-r--r--examples/with-create-react-app/apps/docs/src/reportWebVitals.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/with-create-react-app/apps/docs/src/reportWebVitals.ts b/examples/with-create-react-app/apps/docs/src/reportWebVitals.ts
new file mode 100644
index 0000000..5fa3583
--- /dev/null
+++ b/examples/with-create-react-app/apps/docs/src/reportWebVitals.ts
@@ -0,0 +1,15 @@
+import { ReportHandler } from "web-vitals";
+
+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);
+ });
+ }
+};
+
+export default reportWebVitals;