aboutsummaryrefslogtreecommitdiff
path: root/src/reportWebVitals.ts
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-15 16:05:47 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-15 16:05:47 +0530
commit45bc041389228e43d6845424131292e60934f424 (patch)
tree24f6c0dd029bcb3b08cc9a9158b6f9079da654f3 /src/reportWebVitals.ts
Initial commit
Diffstat (limited to 'src/reportWebVitals.ts')
-rw-r--r--src/reportWebVitals.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/reportWebVitals.ts b/src/reportWebVitals.ts
new file mode 100644
index 0000000..49a2a16
--- /dev/null
+++ b/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;