@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.js
CHANGED
|
@@ -12515,6 +12515,36 @@ let visibilityManager;
|
|
|
12515
12515
|
let recording = false;
|
|
12516
12516
|
const customEventQueue = [];
|
|
12517
12517
|
let flushCustomEventQueue;
|
|
12518
|
+
function waitForDOMStabilization(win) {
|
|
12519
|
+
const maxWaitMs = 5e3;
|
|
12520
|
+
return new Promise((resolve2) => {
|
|
12521
|
+
const captureAfterPaint = () => {
|
|
12522
|
+
requestAnimationFrame(() => {
|
|
12523
|
+
requestAnimationFrame(() => {
|
|
12524
|
+
resolve2();
|
|
12525
|
+
});
|
|
12526
|
+
});
|
|
12527
|
+
};
|
|
12528
|
+
const safeResolve = /* @__PURE__ */ (() => {
|
|
12529
|
+
let called = false;
|
|
12530
|
+
return () => {
|
|
12531
|
+
if (!called) {
|
|
12532
|
+
called = true;
|
|
12533
|
+
captureAfterPaint();
|
|
12534
|
+
}
|
|
12535
|
+
};
|
|
12536
|
+
})();
|
|
12537
|
+
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
12538
|
+
safeResolve();
|
|
12539
|
+
} else {
|
|
12540
|
+
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
12541
|
+
win.addEventListener("load", safeResolve, { once: true });
|
|
12542
|
+
setTimeout(() => {
|
|
12543
|
+
safeResolve();
|
|
12544
|
+
}, maxWaitMs);
|
|
12545
|
+
}
|
|
12546
|
+
});
|
|
12547
|
+
}
|
|
12518
12548
|
try {
|
|
12519
12549
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
12520
12550
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -13006,8 +13036,28 @@ function record(options = {}) {
|
|
|
13006
13036
|
flushCustomEventQueue();
|
|
13007
13037
|
}
|
|
13008
13038
|
};
|
|
13039
|
+
const runInit = async () => {
|
|
13040
|
+
if (flushCustomEvent === "before") {
|
|
13041
|
+
flushCustomEventQueue();
|
|
13042
|
+
}
|
|
13043
|
+
if (recordAfter === "DOMContentStabilized") {
|
|
13044
|
+
console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
|
|
13045
|
+
await waitForDOMStabilization(window);
|
|
13046
|
+
console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
|
|
13047
|
+
}
|
|
13048
|
+
takeFullSnapshot$1();
|
|
13049
|
+
handlers.push(observe(document));
|
|
13050
|
+
recording = true;
|
|
13051
|
+
if (flushCustomEvent === "after") {
|
|
13052
|
+
flushCustomEventQueue();
|
|
13053
|
+
}
|
|
13054
|
+
};
|
|
13009
13055
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
13010
|
-
|
|
13056
|
+
if (recordAfter === "DOMContentStabilized") {
|
|
13057
|
+
void runInit();
|
|
13058
|
+
} else {
|
|
13059
|
+
init();
|
|
13060
|
+
}
|
|
13011
13061
|
} else {
|
|
13012
13062
|
handlers.push(
|
|
13013
13063
|
on("DOMContentLoaded", () => {
|
|
@@ -13015,7 +13065,9 @@ function record(options = {}) {
|
|
|
13015
13065
|
type: EventType.DomContentLoaded,
|
|
13016
13066
|
data: {}
|
|
13017
13067
|
});
|
|
13018
|
-
if (recordAfter === "DOMContentLoaded")
|
|
13068
|
+
if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
|
|
13069
|
+
void runInit();
|
|
13070
|
+
}
|
|
13019
13071
|
})
|
|
13020
13072
|
);
|
|
13021
13073
|
handlers.push(
|
|
@@ -13026,7 +13078,7 @@ function record(options = {}) {
|
|
|
13026
13078
|
type: EventType.Load,
|
|
13027
13079
|
data: {}
|
|
13028
13080
|
});
|
|
13029
|
-
if (recordAfter === "load")
|
|
13081
|
+
if (recordAfter === "load") void runInit();
|
|
13030
13082
|
},
|
|
13031
13083
|
window
|
|
13032
13084
|
)
|
|
@@ -13043,6 +13095,7 @@ function record(options = {}) {
|
|
|
13043
13095
|
console.warn(error);
|
|
13044
13096
|
}
|
|
13045
13097
|
}
|
|
13098
|
+
record.isRecording = () => recording;
|
|
13046
13099
|
record.flushCustomEventQueue = () => {
|
|
13047
13100
|
console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
|
|
13048
13101
|
flushCustomEventQueue();
|