astro-web-vitals-pocketbase
Version:
14 lines (12 loc) • 357 B
text/typescript
import { onCLS, onFCP, onINP, onLCP, onTTFB, type Metric } from "web-vitals";
/**
* Start collecting web vitals metrics.
* Each metric is reported to the provided callback function.
*/
export function setupMetricCollection(report: (metric: Metric) => void): void {
onCLS(report);
onLCP(report);
onINP(report);
onFCP(report);
onTTFB(report);
}