@appsurify-testmap/rrweb 2.1.2-alpha.2 → 2.1.2-alpha.5

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