@appsurify-testmap/rrweb 2.1.2-alpha.1 → 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.cjs CHANGED
@@ -820,10 +820,13 @@ function inspectInlineEventHandlers$1() {
820
820
  });
821
821
  });
822
822
  }
823
- if (document.readyState === "complete" || document.readyState === "interactive") {
824
- inspectInlineEventHandlers$1();
825
- } else {
826
- document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
823
+ try {
824
+ if (document.readyState === "complete" || document.readyState === "interactive") {
825
+ inspectInlineEventHandlers$1();
826
+ } else {
827
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
828
+ }
829
+ } catch (error) {
827
830
  }
828
831
  let _id = 1;
829
832
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -5887,10 +5890,13 @@ function inspectInlineEventHandlers() {
5887
5890
  });
5888
5891
  });
5889
5892
  }
5890
- if (document.readyState === "complete" || document.readyState === "interactive") {
5891
- inspectInlineEventHandlers();
5892
- } else {
5893
- document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5893
+ try {
5894
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5895
+ inspectInlineEventHandlers();
5896
+ } else {
5897
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5898
+ }
5899
+ } catch (error) {
5894
5900
  }
5895
5901
  function getDefaultExportFromCjs(x2) {
5896
5902
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -14365,6 +14371,7 @@ class VisibilityManager {
14365
14371
  __publicField(this, "mirror");
14366
14372
  __publicField(this, "mutationCb");
14367
14373
  __publicField(this, "rafId", null);
14374
+ __publicField(this, "intervalId", null);
14368
14375
  __publicField(this, "rafThrottle");
14369
14376
  __publicField(this, "lastFlushTime", 0);
14370
14377
  __publicField(this, "elements", /* @__PURE__ */ new Set());
@@ -14397,7 +14404,7 @@ class VisibilityManager {
14397
14404
  this.throttle = Number((visibilitySampling == null ? void 0 : visibilitySampling.throttle) ?? 100);
14398
14405
  this.threshold = Number((visibilitySampling == null ? void 0 : visibilitySampling.threshold) ?? 0.5);
14399
14406
  this.sensitivity = Number((visibilitySampling == null ? void 0 : visibilitySampling.sensitivity) ?? 0.05);
14400
- this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 100);
14407
+ this.rafThrottle = Number((visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) ?? 50);
14401
14408
  doc.querySelectorAll("*").forEach((el) => this.observe(el));
14402
14409
  const mo = new MutationObserver((mutations) => {
14403
14410
  mutations.forEach((m) => {
@@ -14419,14 +14426,25 @@ class VisibilityManager {
14419
14426
  }
14420
14427
  startPendingFlushLoop() {
14421
14428
  if (this.disabled) return;
14422
- const loop = (timestamp) => {
14423
- if (timestamp - this.lastFlushTime >= this.rafThrottle) {
14424
- this.lastFlushTime = timestamp;
14425
- this.flushPendingVisibilityMutations();
14426
- }
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
+ };
14427
14437
  this.rafId = requestAnimationFrame(loop);
14428
- };
14429
- 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
+ }
14430
14448
  }
14431
14449
  flushPendingVisibilityMutations() {
14432
14450
  if (this.disabled) return;
@@ -14496,6 +14514,7 @@ class VisibilityManager {
14496
14514
  }
14497
14515
  unfreeze() {
14498
14516
  this.frozen = false;
14517
+ this.flushPendingVisibilityMutations();
14499
14518
  }
14500
14519
  lock() {
14501
14520
  this.locked = true;
@@ -14507,10 +14526,17 @@ class VisibilityManager {
14507
14526
  this.elements.clear();
14508
14527
  this.previousState.clear();
14509
14528
  this.pending.clear();
14510
- 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
+ }
14511
14537
  }
14512
14538
  }
14513
- const version$1 = "2.1.2-alpha.1";
14539
+ const version$1 = "2.1.2-alpha.5";
14514
14540
  let wrappedEmit;
14515
14541
  let takeFullSnapshot$1;
14516
14542
  let canvasManager;
@@ -18009,7 +18035,7 @@ class Replayer {
18009
18035
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
18010
18036
  }
18011
18037
  }
18012
- const version = "2.1.2-alpha.1";
18038
+ const version = "2.1.2-alpha.5";
18013
18039
  const { getVersion } = record;
18014
18040
  const { isRecording } = record;
18015
18041
  const { flushCustomEventQueue } = record;