Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/performance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const handler = {
collector: undefined,
useWebVitals: undefined,
};
if (target.useWebVitals && !isNaN(Number(target.fmpTime)) && !isNaN(Number(target.lcpTime)) && !isNaN(Number(target.clsTime))) {
if (target.useWebVitals && !isNaN(Number(target.fmpTime)) && !isNaN(Number(target.lcpTime)) && !isNaN(Number(target.cls))) {
new TracePerf().reportPerf(source, String(target.collector));
}
return true;
Expand Down Expand Up @@ -127,7 +127,7 @@ class TracePerf {
}
private CLS() {
if (!isLayoutShiftSupported()) {
return this.coreWebMetrics.clsTime = -1;
return this.coreWebMetrics.cls = -1;
}
let partValue = 0;
let entryList: LayoutShift[] = [];
Expand All @@ -152,7 +152,7 @@ class TracePerf {
});
if (partValue > 0) {
setTimeout(() => {
this.coreWebMetrics.clsTime = partValue;
this.coreWebMetrics.cls = partValue;
}, 3000);
}
};
Expand Down Expand Up @@ -210,9 +210,9 @@ class TracePerf {
const interaction = getLongestInteraction();
const len = this.inpList.length;

if (interaction && (!len || this.inpList[len - 1].inpTime !== interaction.latency)) {
if (interaction && (!len || this.inpList[len - 1].inpTime !== Math.floor(interaction.latency))) {
const param = {
inpTime: interaction.latency,
inpTime: Math.floor(interaction.latency),
...this.perfInfo,
};
this.inpList.push(param);
Expand Down
Loading