@appsurify-testmap/rrweb-record 2.1.1-alpha.6 → 2.1.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb-record.cjs +56 -3
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +56 -3
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +794 -372
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +24 -22
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-record.cjs
CHANGED
|
@@ -12517,6 +12517,36 @@ let visibilityManager;
|
|
|
12517
12517
|
let recording = false;
|
|
12518
12518
|
const customEventQueue = [];
|
|
12519
12519
|
let flushCustomEventQueue;
|
|
12520
|
+
function waitForDOMStabilization(win) {
|
|
12521
|
+
const maxWaitMs = 5e3;
|
|
12522
|
+
return new Promise((resolve2) => {
|
|
12523
|
+
const captureAfterPaint = () => {
|
|
12524
|
+
requestAnimationFrame(() => {
|
|
12525
|
+
requestAnimationFrame(() => {
|
|
12526
|
+
resolve2();
|
|
12527
|
+
});
|
|
12528
|
+
});
|
|
12529
|
+
};
|
|
12530
|
+
const safeResolve = /* @__PURE__ */ (() => {
|
|
12531
|
+
let called = false;
|
|
12532
|
+
return () => {
|
|
12533
|
+
if (!called) {
|
|
12534
|
+
called = true;
|
|
12535
|
+
captureAfterPaint();
|
|
12536
|
+
}
|
|
12537
|
+
};
|
|
12538
|
+
})();
|
|
12539
|
+
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
12540
|
+
safeResolve();
|
|
12541
|
+
} else {
|
|
12542
|
+
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
12543
|
+
win.addEventListener("load", safeResolve, { once: true });
|
|
12544
|
+
setTimeout(() => {
|
|
12545
|
+
safeResolve();
|
|
12546
|
+
}, maxWaitMs);
|
|
12547
|
+
}
|
|
12548
|
+
});
|
|
12549
|
+
}
|
|
12520
12550
|
try {
|
|
12521
12551
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
12522
12552
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -13008,8 +13038,28 @@ function record(options = {}) {
|
|
|
13008
13038
|
flushCustomEventQueue();
|
|
13009
13039
|
}
|
|
13010
13040
|
};
|
|
13041
|
+
const runInit = async () => {
|
|
13042
|
+
if (flushCustomEvent === "before") {
|
|
13043
|
+
flushCustomEventQueue();
|
|
13044
|
+
}
|
|
13045
|
+
if (recordAfter === "DOMContentStabilized") {
|
|
13046
|
+
console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
|
|
13047
|
+
await waitForDOMStabilization(window);
|
|
13048
|
+
console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
|
|
13049
|
+
}
|
|
13050
|
+
takeFullSnapshot$1();
|
|
13051
|
+
handlers.push(observe(document));
|
|
13052
|
+
recording = true;
|
|
13053
|
+
if (flushCustomEvent === "after") {
|
|
13054
|
+
flushCustomEventQueue();
|
|
13055
|
+
}
|
|
13056
|
+
};
|
|
13011
13057
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
13012
|
-
|
|
13058
|
+
if (recordAfter === "DOMContentStabilized") {
|
|
13059
|
+
void runInit();
|
|
13060
|
+
} else {
|
|
13061
|
+
init();
|
|
13062
|
+
}
|
|
13013
13063
|
} else {
|
|
13014
13064
|
handlers.push(
|
|
13015
13065
|
on("DOMContentLoaded", () => {
|
|
@@ -13017,7 +13067,9 @@ function record(options = {}) {
|
|
|
13017
13067
|
type: EventType.DomContentLoaded,
|
|
13018
13068
|
data: {}
|
|
13019
13069
|
});
|
|
13020
|
-
if (recordAfter === "DOMContentLoaded")
|
|
13070
|
+
if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
|
|
13071
|
+
void runInit();
|
|
13072
|
+
}
|
|
13021
13073
|
})
|
|
13022
13074
|
);
|
|
13023
13075
|
handlers.push(
|
|
@@ -13028,7 +13080,7 @@ function record(options = {}) {
|
|
|
13028
13080
|
type: EventType.Load,
|
|
13029
13081
|
data: {}
|
|
13030
13082
|
});
|
|
13031
|
-
if (recordAfter === "load")
|
|
13083
|
+
if (recordAfter === "load") void runInit();
|
|
13032
13084
|
},
|
|
13033
13085
|
window
|
|
13034
13086
|
)
|
|
@@ -13045,6 +13097,7 @@ function record(options = {}) {
|
|
|
13045
13097
|
console.warn(error);
|
|
13046
13098
|
}
|
|
13047
13099
|
}
|
|
13100
|
+
record.isRecording = () => recording;
|
|
13048
13101
|
record.flushCustomEventQueue = () => {
|
|
13049
13102
|
console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
|
|
13050
13103
|
flushCustomEventQueue();
|