63 lines
2.2 KiB
JavaScript
63 lines
2.2 KiB
JavaScript
// Metro module 1051 (f1052).
|
|
import { whenActivated } from "./Module1038";
|
|
import { getVisibilityWatcher } from "./onVisibilityUpdate";
|
|
import { initMetric } from "./Module1044";
|
|
import { initUnique } from "./Module1049";
|
|
import { LCPEntryManager } from "./LCPEntryManager";
|
|
import { getActivationStart } from "./Module1042";
|
|
import { observe } from "./Module1046";
|
|
import { bindReporter } from "./Module1047";
|
|
import { runOnce } from "./Module1048";
|
|
import { whenIdleOrHidden } from "./Module1053";
|
|
import { removePageListener, addPageListener } from "./Module1041";
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
let c860_2 = [2500, 4000];
|
|
export { c860_2 as LCPThresholds };
|
|
export const onLCP = function(c12680_0, r3 = {}) {
|
|
let c12680_1 = r3;
|
|
whenActivated(() => {
|
|
let c24023_0, c24023_5, c24023_6, stopListeningWrapper2;
|
|
const visibilityWatcher = getVisibilityWatcher();
|
|
const r12 = initMetric("LCP");
|
|
let c24023_2 = r12;
|
|
let c24023_3 = initUnique(c12680_1, LCPEntryManager);
|
|
const handleEntries2 = (a0) => {
|
|
const r28 = c12680_1.reportAllChanges ? a0 : a0.slice(-1);
|
|
for (const item of r28) {
|
|
c24023_3._processEntry(item);
|
|
if (item.startTime < visibilityWatcher.firstHiddenTime) {
|
|
const r12 = Math;
|
|
c24023_2.value = r12.max(item.startTime - getActivationStart(), 0);
|
|
c24023_2.entries = [item];
|
|
c24023_0();
|
|
}
|
|
}
|
|
};
|
|
const r44 = observe("largest-contentful-paint", handleEntries2);
|
|
c24023_5 = r44;
|
|
if (r44) {
|
|
c24023_0 = bindReporter(c12680_0, r12, c860_2, c12680_1.reportAllChanges);
|
|
c24023_6 = runOnce(() => {
|
|
handleEntries2(c24023_5.takeRecords());
|
|
c24023_5.disconnect();
|
|
c24023_0(true);
|
|
});
|
|
stopListeningWrapper2 = (a0) => {
|
|
if (a0.isTrusted) {
|
|
whenIdleOrHidden(c24023_6);
|
|
removePageListener(a0.type, stopListeningWrapper2, {
|
|
capture: true
|
|
});
|
|
}
|
|
};
|
|
for (const item of ["keydown", "click", "visibilitychange"]) {
|
|
addPageListener(item, stopListeningWrapper2, {
|
|
capture: true
|
|
});
|
|
}
|
|
}
|
|
});
|
|
};
|