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