mirror of
https://github.com/bartvdbraak/hellob.art.git
synced 2025-04-26 09:01:21 +00:00
refactor: replace deprecated web-vitals funcs
This commit is contained in:
parent
b9e4f43fb1
commit
2f0d6bdbaf
1 changed files with 6 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
import type { Metric } from 'web-vitals';
|
||||
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
|
||||
import { onCLS, onFCP, onFID, onLCP, onTTFB } from 'web-vitals';
|
||||
|
||||
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
|
||||
|
||||
|
@ -75,11 +75,11 @@ export function webVitals(options: {
|
|||
debug: boolean;
|
||||
}) {
|
||||
try {
|
||||
getFID((metric) => sendToAnalytics(metric, options));
|
||||
getTTFB((metric) => sendToAnalytics(metric, options));
|
||||
getLCP((metric) => sendToAnalytics(metric, options));
|
||||
getCLS((metric) => sendToAnalytics(metric, options));
|
||||
getFCP((metric) => sendToAnalytics(metric, options));
|
||||
onFID((metric) => sendToAnalytics(metric, options));
|
||||
onTTFB((metric) => sendToAnalytics(metric, options));
|
||||
onLCP((metric) => sendToAnalytics(metric, options));
|
||||
onCLS((metric) => sendToAnalytics(metric, options));
|
||||
onFCP((metric) => sendToAnalytics(metric, options));
|
||||
} catch (err) {
|
||||
console.error('[Web Vitals]', err);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue