-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Upgrade api of web-vitals to reflect to version of 4.2.3
- Loading branch information
1 parent
13d70ab
commit 9abbc78
Showing
4 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ReportHandler } from 'web-vitals' | ||
import { MetricType } from 'web-vitals' | ||
|
||
export const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
export const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry) | ||
getFID(onPerfEntry) | ||
getFCP(onPerfEntry) | ||
getLCP(onPerfEntry) | ||
getTTFB(onPerfEntry) | ||
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => { | ||
onCLS(onPerfEntry) | ||
onFID(onPerfEntry) | ||
onFCP(onPerfEntry) | ||
onLCP(onPerfEntry) | ||
onTTFB(onPerfEntry) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ReportHandler } from 'web-vitals' | ||
import { MetricType } from 'web-vitals' | ||
|
||
export const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
export const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry) | ||
getFID(onPerfEntry) | ||
getFCP(onPerfEntry) | ||
getLCP(onPerfEntry) | ||
getTTFB(onPerfEntry) | ||
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => { | ||
onCLS(onPerfEntry) | ||
onFID(onPerfEntry) | ||
onFCP(onPerfEntry) | ||
onLCP(onPerfEntry) | ||
onTTFB(onPerfEntry) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ReportHandler } from 'web-vitals' | ||
import { MetricType } from 'web-vitals' | ||
|
||
export const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
export const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry) | ||
getFID(onPerfEntry) | ||
getFCP(onPerfEntry) | ||
getLCP(onPerfEntry) | ||
getTTFB(onPerfEntry) | ||
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => { | ||
onCLS(onPerfEntry) | ||
onFID(onPerfEntry) | ||
onFCP(onPerfEntry) | ||
onLCP(onPerfEntry) | ||
onTTFB(onPerfEntry) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ReportHandler } from 'web-vitals' | ||
import { MetricType } from 'web-vitals' | ||
|
||
export const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
export const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry) | ||
getFID(onPerfEntry) | ||
getFCP(onPerfEntry) | ||
getLCP(onPerfEntry) | ||
getTTFB(onPerfEntry) | ||
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => { | ||
onCLS(onPerfEntry) | ||
onFID(onPerfEntry) | ||
onFCP(onPerfEntry) | ||
onLCP(onPerfEntry) | ||
onTTFB(onPerfEntry) | ||
}) | ||
} | ||
} |