Skip to content

Commit afb1e78

Browse files
committed
v6.8.4
1 parent e4028ab commit afb1e78

File tree

8 files changed

+22
-10
lines changed

8 files changed

+22
-10
lines changed

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "6.8.3",
3+
"version": "6.8.4",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

published/6.8.3/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/6.8.4/appwidget.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/6.8.4/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/6.8.4/index.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ReplayRecorder.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default class ReplayRecorder {
2020
this.node = document.documentElement;
2121
this.nextID = 1;
2222
this.actions = [];
23+
this.actionsSize = 0;
2324
this.lastActionTime = Date.now();
2425
this.observerCallback = this.callback.bind(this);
2526
this.resourcesToResolve = {};
@@ -30,7 +31,7 @@ export default class ReplayRecorder {
3031
}
3132

3233
isFull() {
33-
if (this.actions && gleapRoughSizeOfObject(this.actions) > 10) {
34+
if (this.actions && this.actionsSize > 10) {
3435
return true;
3536
}
3637
return false;
@@ -464,6 +465,14 @@ export default class ReplayRecorder {
464465
}
465466
}
466467

468+
appendAction(action) {
469+
this.actions.push(action);
470+
const self = this;
471+
setTimeout(function () {
472+
self.actionsSize += gleapRoughSizeOfObject(action);
473+
}, 0);
474+
}
475+
467476
callback(
468477
records,
469478
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -473,7 +482,7 @@ export default class ReplayRecorder {
473482
if (now > this.lastActionTime) {
474483
const a = {};
475484
a[REPLAYREC_DELAY] = now - this.lastActionTime;
476-
this.actions.push(a);
485+
this.appendAction(a);
477486
}
478487
this.lastActionTime = Date.now();
479488

@@ -487,7 +496,7 @@ export default class ReplayRecorder {
487496
}
488497
const a = {};
489498
a[REPLAYREC_REMOVE] = childID;
490-
this.actions.push(a);
499+
this.appendAction(a);
491500
this.deleteAllReplayRecIDs(child);
492501
}
493502
}
@@ -519,7 +528,7 @@ export default class ReplayRecorder {
519528
);
520529
}
521530

522-
this.actions.push(a);
531+
this.appendAction(a);
523532
}
524533
break;
525534
}
@@ -528,7 +537,7 @@ export default class ReplayRecorder {
528537
if (target.nodeType === Node.TEXT_NODE) {
529538
a[REPLAYREC_TEXT] = [id, target.data];
530539
}
531-
this.actions.push(a);
540+
this.appendAction(a);
532541
break;
533542
}
534543
case "childList": {
@@ -558,7 +567,7 @@ export default class ReplayRecorder {
558567
serializedNode,
559568
actions,
560569
];
561-
this.actions.push(a);
570+
this.appendAction(a);
562571
}
563572
}
564573
} catch (ex) {

0 commit comments

Comments
 (0)