summaryrefslogtreecommitdiff
path: root/src/reportWebVitals.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-03-13 21:40:29 +0300
committereug-vs <eug-vs@keemail.me>2021-03-13 21:40:29 +0300
commit58c47725b9f2c171065b9e35cdbc0e4525ec7255 (patch)
treee29351810c0e35743f1fdbcc4f74f6352dceecaa /src/reportWebVitals.ts
downloadcommercel-ui-58c47725b9f2c171065b9e35cdbc0e4525ec7255.tar.gz
Initialize project using Create React App
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;