@appsurify-testmap/rrweb-record 2.1.2-alpha.2 → 2.1.3-alpha.1

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.
@@ -12444,6 +12444,7 @@ class VisibilityManager {
12444
12444
  __publicField(this, "mirror");
12445
12445
  __publicField(this, "mutationCb");
12446
12446
  __publicField(this, "rafId", null);
12447
+ __publicField(this, "intervalId", null);
12447
12448
  __publicField(this, "rafThrottle");
12448
12449
  __publicField(this, "lastFlushTime", 0);
12449
12450
  __publicField(this, "elements", /* @__PURE__ */ new Set());
@@ -12476,7 +12477,7 @@ class VisibilityManager {
12476
12477
  this.throttle = Number((visibilitySampling == null ? void 0 : visibilitySampling.throttle) ?? 100);
12477
12478
  this.threshold = Number((visibilitySampling == null ? void 0 : visibilitySampling.threshold) ?? 0.5);
12478
12479
  this.sensitivity = Number((visibilitySampling == null ? void 0 : visibilitySampling.sensitivity) ?? 0.05);
12479
- this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 100);
12480
+ this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 50);
12480
12481
  doc.querySelectorAll("*").forEach((el) => this.observe(el));
12481
12482
  const mo = new MutationObserver((mutations) => {
12482
12483
  mutations.forEach((m) => {
@@ -12498,14 +12499,25 @@ class VisibilityManager {
12498
12499
  }
12499
12500
  startPendingFlushLoop() {
12500
12501
  if (this.disabled) return;
12501
- const loop = (timestamp) => {
12502
- if (timestamp - this.lastFlushTime >= this.rafThrottle) {
12503
- this.lastFlushTime = timestamp;
12504
- this.flushPendingVisibilityMutations();
12505
- }
12502
+ if (typeof requestAnimationFrame === "function") {
12503
+ const loop = (timestamp) => {
12504
+ if (timestamp - this.lastFlushTime >= this.rafThrottle) {
12505
+ this.lastFlushTime = timestamp;
12506
+ this.flushPendingVisibilityMutations();
12507
+ }
12508
+ this.rafId = requestAnimationFrame(loop);
12509
+ };
12506
12510
  this.rafId = requestAnimationFrame(loop);
12507
- };
12508
- this.rafId = requestAnimationFrame(loop);
12511
+ } else {
12512
+ const loop = () => {
12513
+ const now = performance.now();
12514
+ if (now - this.lastFlushTime >= this.rafThrottle) {
12515
+ this.lastFlushTime = now;
12516
+ this.flushPendingVisibilityMutations();
12517
+ }
12518
+ };
12519
+ this.intervalId = setInterval(loop, this.rafThrottle);
12520
+ }
12509
12521
  }
12510
12522
  flushPendingVisibilityMutations() {
12511
12523
  if (this.disabled) return;
@@ -12575,6 +12587,7 @@ class VisibilityManager {
12575
12587
  }
12576
12588
  unfreeze() {
12577
12589
  this.frozen = false;
12590
+ this.flushPendingVisibilityMutations();
12578
12591
  }
12579
12592
  lock() {
12580
12593
  this.locked = true;
@@ -12586,10 +12599,17 @@ class VisibilityManager {
12586
12599
  this.elements.clear();
12587
12600
  this.previousState.clear();
12588
12601
  this.pending.clear();
12589
- if (this.rafId) cancelAnimationFrame(this.rafId);
12602
+ if (this.rafId) {
12603
+ cancelAnimationFrame(this.rafId);
12604
+ this.rafId = null;
12605
+ }
12606
+ if (this.intervalId) {
12607
+ clearInterval(this.intervalId);
12608
+ this.intervalId = null;
12609
+ }
12590
12610
  }
12591
12611
  }
12592
- const version$1 = "2.1.2-alpha.2";
12612
+ const version$1 = "2.1.3-alpha.1";
12593
12613
  let wrappedEmit;
12594
12614
  let takeFullSnapshot$1;
12595
12615
  let canvasManager;