Skip to content

Commit

Permalink
fix: multiply CLS since api support int only
Browse files Browse the repository at this point in the history
  • Loading branch information
muratcorlu committed Feb 25, 2024
1 parent 6a99ce2 commit bd460bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/event.ts
Expand Up @@ -25,9 +25,9 @@ const webVitals: {
inp?: number,
} = {};

const setVital = (name) => ({ delta }) => webVitals[name] = ~~delta;
const setVital = (name, multiplier = 1) => ({ delta }) => webVitals[name] = ~~(delta * multiplier);

onCLS(setVital('cls'));
onCLS(setVital('cls', 10000));
onFCP(setVital('fcp'));
onFID(setVital('fid'));
onLCP(setVital('lcp'));
Expand Down

0 comments on commit bd460bf

Please sign in to comment.