@appsurify-testmap/rrweb 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.
package/dist/rrweb.cjs CHANGED
@@ -14371,6 +14371,7 @@ class VisibilityManager {
14371
14371
  __publicField(this, "mirror");
14372
14372
  __publicField(this, "mutationCb");
14373
14373
  __publicField(this, "rafId", null);
14374
+ __publicField(this, "intervalId", null);
14374
14375
  __publicField(this, "rafThrottle");
14375
14376
  __publicField(this, "lastFlushTime", 0);
14376
14377
  __publicField(this, "elements", /* @__PURE__ */ new Set());
@@ -14403,7 +14404,7 @@ class VisibilityManager {
14403
14404
  this.throttle = Number((visibilitySampling == null ? void 0 : visibilitySampling.throttle) ?? 100);
14404
14405
  this.threshold = Number((visibilitySampling == null ? void 0 : visibilitySampling.threshold) ?? 0.5);
14405
14406
  this.sensitivity = Number((visibilitySampling == null ? void 0 : visibilitySampling.sensitivity) ?? 0.05);
14406
- this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 100);
14407
+ this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 50);
14407
14408
  doc.querySelectorAll("*").forEach((el) => this.observe(el));
14408
14409
  const mo = new MutationObserver((mutations) => {
14409
14410
  mutations.forEach((m) => {
@@ -14425,14 +14426,25 @@ class VisibilityManager {
14425
14426
  }
14426
14427
  startPendingFlushLoop() {
14427
14428
  if (this.disabled) return;
14428
- const loop = (timestamp) => {
14429
- if (timestamp - this.lastFlushTime >= this.rafThrottle) {
14430
- this.lastFlushTime = timestamp;
14431
- this.flushPendingVisibilityMutations();
14432
- }
14429
+ if (typeof requestAnimationFrame === "function") {
14430
+ const loop = (timestamp) => {
14431
+ if (timestamp - this.lastFlushTime >= this.rafThrottle) {
14432
+ this.lastFlushTime = timestamp;
14433
+ this.flushPendingVisibilityMutations();
14434
+ }
14435
+ this.rafId = requestAnimationFrame(loop);
14436
+ };
14433
14437
  this.rafId = requestAnimationFrame(loop);
14434
- };
14435
- this.rafId = requestAnimationFrame(loop);
14438
+ } else {
14439
+ const loop = () => {
14440
+ const now = performance.now();
14441
+ if (now - this.lastFlushTime >= this.rafThrottle) {
14442
+ this.lastFlushTime = now;
14443
+ this.flushPendingVisibilityMutations();
14444
+ }
14445
+ };
14446
+ this.intervalId = setInterval(loop, this.rafThrottle);
14447
+ }
14436
14448
  }
14437
14449
  flushPendingVisibilityMutations() {
14438
14450
  if (this.disabled) return;
@@ -14502,6 +14514,7 @@ class VisibilityManager {
14502
14514
  }
14503
14515
  unfreeze() {
14504
14516
  this.frozen = false;
14517
+ this.flushPendingVisibilityMutations();
14505
14518
  }
14506
14519
  lock() {
14507
14520
  this.locked = true;
@@ -14513,10 +14526,17 @@ class VisibilityManager {
14513
14526
  this.elements.clear();
14514
14527
  this.previousState.clear();
14515
14528
  this.pending.clear();
14516
- if (this.rafId) cancelAnimationFrame(this.rafId);
14529
+ if (this.rafId) {
14530
+ cancelAnimationFrame(this.rafId);
14531
+ this.rafId = null;
14532
+ }
14533
+ if (this.intervalId) {
14534
+ clearInterval(this.intervalId);
14535
+ this.intervalId = null;
14536
+ }
14517
14537
  }
14518
14538
  }
14519
- const version$1 = "2.1.2-alpha.2";
14539
+ const version$1 = "2.1.3-alpha.1";
14520
14540
  let wrappedEmit;
14521
14541
  let takeFullSnapshot$1;
14522
14542
  let canvasManager;
@@ -18015,7 +18035,7 @@ class Replayer {
18015
18035
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
18016
18036
  }
18017
18037
  }
18018
- const version = "2.1.2-alpha.2";
18038
+ const version = "2.1.3-alpha.1";
18019
18039
  const { getVersion } = record;
18020
18040
  const { isRecording } = record;
18021
18041
  const { flushCustomEventQueue } = record;