@appsurify-testmap/rrweb-record 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.
@@ -12860,6 +12860,7 @@ class VisibilityManager {
12860
12860
  __publicField(this, "mirror");
12861
12861
  __publicField(this, "mutationCb");
12862
12862
  __publicField(this, "rafId", null);
12863
+ __publicField(this, "intervalId", null);
12863
12864
  __publicField(this, "rafThrottle");
12864
12865
  __publicField(this, "lastFlushTime", 0);
12865
12866
  __publicField(this, "elements", /* @__PURE__ */ new Set());
@@ -12892,7 +12893,7 @@ class VisibilityManager {
12892
12893
  this.throttle = Number((_c = visibilitySampling == null ? void 0 : visibilitySampling.throttle) != null ? _c : 100);
12893
12894
  this.threshold = Number((_d = visibilitySampling == null ? void 0 : visibilitySampling.threshold) != null ? _d : 0.5);
12894
12895
  this.sensitivity = Number((_e = visibilitySampling == null ? void 0 : visibilitySampling.sensitivity) != null ? _e : 0.05);
12895
- this.rafThrottle = Number((_f = visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) != null ? _f : 100);
12896
+ this.rafThrottle = Number((_f = visibilitySampling == null ? void 0 : visibilitySampling.rafThrottle) != null ? _f : 50);
12896
12897
  doc.querySelectorAll("*").forEach((el) => this.observe(el));
12897
12898
  const mo = new MutationObserver((mutations) => {
12898
12899
  mutations.forEach((m) => {
@@ -12915,14 +12916,25 @@ class VisibilityManager {
12915
12916
  startPendingFlushLoop() {
12916
12917
  if (this.disabled)
12917
12918
  return;
12918
- const loop = (timestamp) => {
12919
- if (timestamp - this.lastFlushTime >= this.rafThrottle) {
12920
- this.lastFlushTime = timestamp;
12921
- this.flushPendingVisibilityMutations();
12922
- }
12919
+ if (typeof requestAnimationFrame === "function") {
12920
+ const loop = (timestamp) => {
12921
+ if (timestamp - this.lastFlushTime >= this.rafThrottle) {
12922
+ this.lastFlushTime = timestamp;
12923
+ this.flushPendingVisibilityMutations();
12924
+ }
12925
+ this.rafId = requestAnimationFrame(loop);
12926
+ };
12923
12927
  this.rafId = requestAnimationFrame(loop);
12924
- };
12925
- this.rafId = requestAnimationFrame(loop);
12928
+ } else {
12929
+ const loop = () => {
12930
+ const now = performance.now();
12931
+ if (now - this.lastFlushTime >= this.rafThrottle) {
12932
+ this.lastFlushTime = now;
12933
+ this.flushPendingVisibilityMutations();
12934
+ }
12935
+ };
12936
+ this.intervalId = setInterval(loop, this.rafThrottle);
12937
+ }
12926
12938
  }
12927
12939
  flushPendingVisibilityMutations() {
12928
12940
  if (this.disabled)
@@ -12997,6 +13009,7 @@ class VisibilityManager {
12997
13009
  }
12998
13010
  unfreeze() {
12999
13011
  this.frozen = false;
13012
+ this.flushPendingVisibilityMutations();
13000
13013
  }
13001
13014
  lock() {
13002
13015
  this.locked = true;
@@ -13008,11 +13021,17 @@ class VisibilityManager {
13008
13021
  this.elements.clear();
13009
13022
  this.previousState.clear();
13010
13023
  this.pending.clear();
13011
- if (this.rafId)
13024
+ if (this.rafId) {
13012
13025
  cancelAnimationFrame(this.rafId);
13026
+ this.rafId = null;
13027
+ }
13028
+ if (this.intervalId) {
13029
+ clearInterval(this.intervalId);
13030
+ this.intervalId = null;
13031
+ }
13013
13032
  }
13014
13033
  }
13015
- const version$1 = "2.1.2-alpha.2";
13034
+ const version$1 = "2.1.2-alpha.5";
13016
13035
  let wrappedEmit;
13017
13036
  let takeFullSnapshot$1;
13018
13037
  let canvasManager;