@glimt/record 0.0.79 → 0.0.80
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/record.cjs +41 -8
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +41 -8
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +41 -8
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +21 -21
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.js
CHANGED
|
@@ -10291,6 +10291,9 @@ const _ObserveManager = class _ObserveManager2 {
|
|
|
10291
10291
|
constructor() {
|
|
10292
10292
|
__publicField(this, "docsObservers", /* @__PURE__ */ new WeakSet());
|
|
10293
10293
|
__publicField(this, "shadowRootsObservers", /* @__PURE__ */ new WeakSet());
|
|
10294
|
+
__publicField(this, "docsDebounceTimers", /* @__PURE__ */ new WeakMap());
|
|
10295
|
+
__publicField(this, "shadowRootsDebounceTimers", /* @__PURE__ */ new WeakMap());
|
|
10296
|
+
__publicField(this, "debounceTime", 15);
|
|
10294
10297
|
__publicField(this, "mutationOptions");
|
|
10295
10298
|
__publicField(this, "emitter", null);
|
|
10296
10299
|
__publicField(this, "isSnapshottingShadowRoots", false);
|
|
@@ -10368,12 +10371,46 @@ const _ObserveManager = class _ObserveManager2 {
|
|
|
10368
10371
|
});
|
|
10369
10372
|
}
|
|
10370
10373
|
serializeAndEmitDoc(doc) {
|
|
10374
|
+
debugLog(
|
|
10375
|
+
"onDocObserver: doc already observed, emitting full snapshot for doc",
|
|
10376
|
+
doc
|
|
10377
|
+
);
|
|
10378
|
+
this.isSnapshottingDocs = true;
|
|
10371
10379
|
const serialized = this.serializeDoc(doc);
|
|
10372
10380
|
this.emitDoc(serialized);
|
|
10381
|
+
this.isSnapshottingDocs = false;
|
|
10373
10382
|
}
|
|
10374
10383
|
serializeAndEmitShadowRoot(shadowRoot2) {
|
|
10384
|
+
debugLog(
|
|
10385
|
+
"onShadowRootObserver: shadowRoot already observed, emitting full snapshot for shadowRoot",
|
|
10386
|
+
shadowRoot2
|
|
10387
|
+
);
|
|
10388
|
+
this.isSnapshottingShadowRoots = true;
|
|
10375
10389
|
const serialized = this.serializeDoc(shadowRoot2.ownerDocument);
|
|
10376
10390
|
this.emitShadowRoot(serialized, shadowRoot2);
|
|
10391
|
+
this.isSnapshottingShadowRoots = false;
|
|
10392
|
+
}
|
|
10393
|
+
debounceEmitDoc(doc) {
|
|
10394
|
+
const existingTimer = this.docsDebounceTimers.get(doc);
|
|
10395
|
+
if (existingTimer) clearTimeout(existingTimer);
|
|
10396
|
+
this.docsDebounceTimers.set(
|
|
10397
|
+
doc,
|
|
10398
|
+
setTimeout(() => {
|
|
10399
|
+
this.docsDebounceTimers.delete(doc);
|
|
10400
|
+
this.serializeAndEmitDoc(doc);
|
|
10401
|
+
}, this.debounceTime)
|
|
10402
|
+
);
|
|
10403
|
+
}
|
|
10404
|
+
debounceEmitShadowRoot(shadowRoot2) {
|
|
10405
|
+
const existingTimer = this.shadowRootsDebounceTimers.get(shadowRoot2);
|
|
10406
|
+
if (existingTimer) clearTimeout(existingTimer);
|
|
10407
|
+
this.shadowRootsDebounceTimers.set(
|
|
10408
|
+
shadowRoot2,
|
|
10409
|
+
setTimeout(() => {
|
|
10410
|
+
this.shadowRootsDebounceTimers.delete(shadowRoot2);
|
|
10411
|
+
this.serializeAndEmitShadowRoot(shadowRoot2);
|
|
10412
|
+
}, this.debounceTime)
|
|
10413
|
+
);
|
|
10377
10414
|
}
|
|
10378
10415
|
onDocObserver(doc) {
|
|
10379
10416
|
if (this.isSnapshottingDocs) return false;
|
|
@@ -10383,12 +10420,10 @@ const _ObserveManager = class _ObserveManager2 {
|
|
|
10383
10420
|
return true;
|
|
10384
10421
|
}
|
|
10385
10422
|
debugLog(
|
|
10386
|
-
"onDocObserver: doc already observed,
|
|
10423
|
+
"onDocObserver: doc already observed, debouncing full snapshot for doc",
|
|
10387
10424
|
doc
|
|
10388
10425
|
);
|
|
10389
|
-
this.
|
|
10390
|
-
this.serializeAndEmitDoc(doc);
|
|
10391
|
-
this.isSnapshottingDocs = false;
|
|
10426
|
+
this.debounceEmitDoc(doc);
|
|
10392
10427
|
return false;
|
|
10393
10428
|
}
|
|
10394
10429
|
onShadowRootObserver(shadowRoot2) {
|
|
@@ -10399,12 +10434,10 @@ const _ObserveManager = class _ObserveManager2 {
|
|
|
10399
10434
|
return true;
|
|
10400
10435
|
}
|
|
10401
10436
|
debugLog(
|
|
10402
|
-
"onShadowRootObserver: shadowRoot already observed,
|
|
10437
|
+
"onShadowRootObserver: shadowRoot already observed, debouncing full snapshot for shadowRoot",
|
|
10403
10438
|
shadowRoot2
|
|
10404
10439
|
);
|
|
10405
|
-
this.
|
|
10406
|
-
this.serializeAndEmitShadowRoot(shadowRoot2);
|
|
10407
|
-
this.isSnapshottingShadowRoots = false;
|
|
10440
|
+
this.debounceEmitShadowRoot(shadowRoot2);
|
|
10408
10441
|
return false;
|
|
10409
10442
|
}
|
|
10410
10443
|
// canObserveDoc(doc: Document) {
|