@glimt/record 0.0.34 → 0.0.36
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 +18 -66
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +18 -66
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +18 -66
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +17 -17
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.cjs
CHANGED
|
@@ -1172,7 +1172,6 @@ function serializeTextNode(n2, options) {
|
|
|
1172
1172
|
};
|
|
1173
1173
|
}
|
|
1174
1174
|
function serializeElementNode(n2, options) {
|
|
1175
|
-
const start = performance.now();
|
|
1176
1175
|
const {
|
|
1177
1176
|
doc,
|
|
1178
1177
|
blockClass,
|
|
@@ -1371,19 +1370,6 @@ function serializeElementNode(n2, options) {
|
|
|
1371
1370
|
if (customElements.get(tagName)) isCustomElement = true;
|
|
1372
1371
|
} catch (e2) {
|
|
1373
1372
|
}
|
|
1374
|
-
const took = performance.now() - start;
|
|
1375
|
-
if (!window.serialization_perf_map) window.serialization_perf_map = {};
|
|
1376
|
-
if (!(tagName in window.serialization_perf_map)) {
|
|
1377
|
-
window.serialization_perf_map[tagName] = {
|
|
1378
|
-
avg: 0,
|
|
1379
|
-
times: []
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
window.serialization_perf_map[tagName].times.push(took);
|
|
1383
|
-
if (window.serialization_perf_map[tagName].times.length > 1e3) {
|
|
1384
|
-
window.serialization_perf_map[tagName].times.shift();
|
|
1385
|
-
}
|
|
1386
|
-
window.serialization_perf_map[tagName].avg = window.serialization_perf_map[tagName].times.reduce((a2, b) => a2 + b, 0) / window.serialization_perf_map[tagName].times.length;
|
|
1387
1373
|
return {
|
|
1388
1374
|
type: NodeType$2.Element,
|
|
1389
1375
|
tagName,
|
|
@@ -9644,7 +9630,10 @@ const _StormSnapshotManager = class _StormSnapshotManager2 {
|
|
|
9644
9630
|
//before we actually take a full snapshot.
|
|
9645
9631
|
//also, we want a low debounceTime, bc if theres multiple, distinctive mutation storms,
|
|
9646
9632
|
//in a somewhat quick succession, we want to record activity between them
|
|
9647
|
-
//not just one full snapshot after all the storms
|
|
9633
|
+
//not just one full snapshot after all the storms:
|
|
9634
|
+
//[mutation storm] [full snapshot] [mutation storm] [full snapshot]
|
|
9635
|
+
//NOT
|
|
9636
|
+
//[mutation storm] [timeout] [mutation storm] [full snapshot] (in this case, we probably miss all events which fired during the timeout)
|
|
9648
9637
|
requestFullSnapshot() {
|
|
9649
9638
|
if (this.debounceTimeout) {
|
|
9650
9639
|
clearTimeout(this.debounceTimeout);
|
|
@@ -9748,15 +9737,6 @@ class DoubleLinkedList {
|
|
|
9748
9737
|
}
|
|
9749
9738
|
}
|
|
9750
9739
|
const moveKey = (id, parentId) => `${id}@${parentId}`;
|
|
9751
|
-
function makeid(length = 8) {
|
|
9752
|
-
var result2 = "";
|
|
9753
|
-
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
9754
|
-
var charactersLength = characters.length;
|
|
9755
|
-
for (var i2 = 0; i2 < length; i2++) {
|
|
9756
|
-
result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
9757
|
-
}
|
|
9758
|
-
return result2;
|
|
9759
|
-
}
|
|
9760
9740
|
class MutationBuffer {
|
|
9761
9741
|
constructor() {
|
|
9762
9742
|
__publicField(this, "frozen", false);
|
|
@@ -9793,22 +9773,19 @@ class MutationBuffer {
|
|
|
9793
9773
|
__publicField(this, "canvasManager");
|
|
9794
9774
|
__publicField(this, "processedNodeManager");
|
|
9795
9775
|
__publicField(this, "unattachedDoc");
|
|
9796
|
-
__publicField(this, "bufId", makeid());
|
|
9797
9776
|
__publicField(this, "stormBatches", []);
|
|
9798
|
-
__publicField(this, "stormInfo");
|
|
9777
|
+
__publicField(this, "stormInfo", null);
|
|
9799
9778
|
__publicField(this, "stormSettings", {
|
|
9800
|
-
batchSize:
|
|
9801
|
-
|
|
9802
|
-
|
|
9779
|
+
batchSize: 150,
|
|
9780
|
+
//was 300
|
|
9781
|
+
timeout: 30,
|
|
9782
|
+
//was 50
|
|
9783
|
+
mutationLimit: 800
|
|
9784
|
+
//was 1500
|
|
9803
9785
|
});
|
|
9804
9786
|
__publicField(this, "handleStormMutations", (muts) => {
|
|
9805
9787
|
const time = Date.now();
|
|
9806
9788
|
if (this.stormInfo == null) {
|
|
9807
|
-
console.log(
|
|
9808
|
-
"detected probable mutation storm start",
|
|
9809
|
-
"buffer id:",
|
|
9810
|
-
this.bufId
|
|
9811
|
-
);
|
|
9812
9789
|
this.stormInfo = {
|
|
9813
9790
|
startedAt: time,
|
|
9814
9791
|
totalMutations: 0,
|
|
@@ -9817,12 +9794,6 @@ class MutationBuffer {
|
|
|
9817
9794
|
};
|
|
9818
9795
|
}
|
|
9819
9796
|
this.stormInfo.totalMutations += muts.length;
|
|
9820
|
-
console.log(
|
|
9821
|
-
"current storm mutations",
|
|
9822
|
-
this.stormInfo.totalMutations,
|
|
9823
|
-
"buffer id:",
|
|
9824
|
-
this.bufId
|
|
9825
|
-
);
|
|
9826
9797
|
if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
|
|
9827
9798
|
this.stormInfo.stormExceededLimit = true;
|
|
9828
9799
|
this.stormBatches = [];
|
|
@@ -9832,26 +9803,19 @@ class MutationBuffer {
|
|
|
9832
9803
|
mutations: muts
|
|
9833
9804
|
});
|
|
9834
9805
|
}
|
|
9806
|
+
clearTimeout(this.stormInfo.timeout);
|
|
9835
9807
|
if (muts.length < this.stormSettings.batchSize) {
|
|
9836
|
-
clearTimeout(this.stormInfo.timeout);
|
|
9837
9808
|
this.handleStormFinish();
|
|
9809
|
+
} else {
|
|
9810
|
+
this.stormInfo.timeout = setTimeout(
|
|
9811
|
+
this.handleStormFinish,
|
|
9812
|
+
this.stormSettings.timeout
|
|
9813
|
+
);
|
|
9838
9814
|
}
|
|
9839
9815
|
});
|
|
9840
9816
|
__publicField(this, "handleStormFinish", () => {
|
|
9841
9817
|
if (!this.stormInfo) return;
|
|
9842
9818
|
const { stormExceededLimit } = this.stormInfo;
|
|
9843
|
-
console.log(
|
|
9844
|
-
"mutation storm finished",
|
|
9845
|
-
"totalMutations:",
|
|
9846
|
-
this.stormInfo.totalMutations,
|
|
9847
|
-
"stormExceededLimit:",
|
|
9848
|
-
stormExceededLimit,
|
|
9849
|
-
"storm duration:",
|
|
9850
|
-
Date.now() - this.stormInfo.startedAt,
|
|
9851
|
-
"ms",
|
|
9852
|
-
"buffer id:",
|
|
9853
|
-
this.bufId
|
|
9854
|
-
);
|
|
9855
9819
|
clearTimeout(this.stormInfo.timeout);
|
|
9856
9820
|
this.stormInfo = null;
|
|
9857
9821
|
if (!stormExceededLimit) {
|
|
@@ -9871,20 +9835,9 @@ class MutationBuffer {
|
|
|
9871
9835
|
this.handleStormMutations(muts);
|
|
9872
9836
|
return;
|
|
9873
9837
|
}
|
|
9874
|
-
const start = performance.now();
|
|
9875
9838
|
for (const mut of muts) {
|
|
9876
9839
|
this.processMutation(mut);
|
|
9877
9840
|
}
|
|
9878
|
-
console.log(
|
|
9879
|
-
muts.length,
|
|
9880
|
-
"mutations processed in",
|
|
9881
|
-
performance.now() - start,
|
|
9882
|
-
"ms",
|
|
9883
|
-
"overrideStorm",
|
|
9884
|
-
overrideStorm,
|
|
9885
|
-
"buffer id:",
|
|
9886
|
-
this.bufId
|
|
9887
|
-
);
|
|
9888
9841
|
this.emit();
|
|
9889
9842
|
});
|
|
9890
9843
|
__publicField(this, "processMutations", (mutations) => {
|
|
@@ -10350,6 +10303,7 @@ class MutationBuffer {
|
|
|
10350
10303
|
}
|
|
10351
10304
|
});
|
|
10352
10305
|
}
|
|
10306
|
+
// private bufId: string = makeid();
|
|
10353
10307
|
init(options) {
|
|
10354
10308
|
[
|
|
10355
10309
|
"mutationCb",
|
|
@@ -12426,7 +12380,6 @@ function record(options = {}) {
|
|
|
12426
12380
|
if (!recordDOM) {
|
|
12427
12381
|
return;
|
|
12428
12382
|
}
|
|
12429
|
-
const start = performance.now();
|
|
12430
12383
|
wrappedEmit(
|
|
12431
12384
|
{
|
|
12432
12385
|
type: EventType.Meta,
|
|
@@ -12494,7 +12447,6 @@ function record(options = {}) {
|
|
|
12494
12447
|
document.adoptedStyleSheets,
|
|
12495
12448
|
mirror.getId(document)
|
|
12496
12449
|
);
|
|
12497
|
-
console.log("full snapshot took", performance.now() - start, "ms");
|
|
12498
12450
|
};
|
|
12499
12451
|
try {
|
|
12500
12452
|
const handlers = [];
|