summaryrefslogtreecommitdiff
path: root/my-app/src/reportWebVitals.ts
diff options
context:
space:
mode:
authorphyscik <mynameisgennadiy@vk.com>2026-04-10 19:24:08 +0500
committerphyscik <mynameisgennadiy@vk.com>2026-04-10 19:24:40 +0500
commitd5df390bc6e4d2860cf0bb36ffe8e0584ed96f5d (patch)
tree4c7205c88cf5111e68b99902155e47aa1da0bfb0 /my-app/src/reportWebVitals.ts
react app init
Diffstat (limited to 'my-app/src/reportWebVitals.ts')
-rw-r--r--my-app/src/reportWebVitals.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/my-app/src/reportWebVitals.ts b/my-app/src/reportWebVitals.ts
new file mode 100644
index 0000000..49a2a16
--- /dev/null
+++ b/my-app/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;