diff options
| author | twells46 <tom@wellsth.com> | 2026-01-25 11:14:07 -0600 |
|---|---|---|
| committer | twells46 <tom@wellsth.com> | 2026-01-25 11:14:07 -0600 |
| commit | 8e99f04d9cbc420176e6c28cbff30374dba7e03c (patch) | |
| tree | 3b01ea994472e376c0684abe8e7aef778df71e29 /src/reportWebVitals.ts | |
Diffstat (limited to 'src/reportWebVitals.ts')
| -rw-r--r-- | src/reportWebVitals.ts | 15 |
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; |