@posthog/rrweb-player 0.0.24 → 0.0.26
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-player.cjs +61 -9
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +61 -9
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +61 -9
- package/dist/rrweb-player.umd.cjs.map +2 -2
- package/dist/rrweb-player.umd.min.cjs +42 -42
- package/dist/rrweb-player.umd.min.cjs.map +3 -3
- package/package.json +1 -1
|
@@ -4788,6 +4788,12 @@ function buildNodeWithSN(n2, options) {
|
|
|
4788
4788
|
} else {
|
|
4789
4789
|
node2.appendChild(childNode);
|
|
4790
4790
|
}
|
|
4791
|
+
} else if (n2.type === NodeType$1$1.Document && childN.type === NodeType$1$1.DocumentType) {
|
|
4792
|
+
if (node2.firstChild && node2.firstChild.nodeType === 1) {
|
|
4793
|
+
node2.insertBefore(childNode, node2.firstChild);
|
|
4794
|
+
} else {
|
|
4795
|
+
node2.appendChild(childNode);
|
|
4796
|
+
}
|
|
4791
4797
|
} else {
|
|
4792
4798
|
node2.appendChild(childNode);
|
|
4793
4799
|
}
|
|
@@ -11766,6 +11772,11 @@ class Replayer {
|
|
|
11766
11772
|
__publicField2(this, "lastSelectionData", null);
|
|
11767
11773
|
__publicField2(this, "constructedStyleMutations", []);
|
|
11768
11774
|
__publicField2(this, "adoptedStyleSheets", []);
|
|
11775
|
+
__publicField2(this, "emitterHandlers", []);
|
|
11776
|
+
__publicField2(this, "serviceSubscription");
|
|
11777
|
+
__publicField2(this, "speedServiceSubscription");
|
|
11778
|
+
__publicField2(this, "timeouts", /* @__PURE__ */ new Set());
|
|
11779
|
+
__publicField2(this, "styleSheetLoadListeners", /* @__PURE__ */ new Map());
|
|
11769
11780
|
__publicField2(this, "handleResize", (dimension) => {
|
|
11770
11781
|
this.iframe.style.display = "inherit";
|
|
11771
11782
|
for (const el of [this.mouseTail, this.iframe]) {
|
|
@@ -11925,12 +11936,12 @@ class Replayer {
|
|
|
11925
11936
|
this.handleResize = this.handleResize.bind(this);
|
|
11926
11937
|
this.getCastFn = this.getCastFn.bind(this);
|
|
11927
11938
|
this.applyEventsSynchronously = this.applyEventsSynchronously.bind(this);
|
|
11928
|
-
this.
|
|
11939
|
+
this.addEmitterHandler(ReplayerEvents.Resize, this.handleResize);
|
|
11929
11940
|
this.setupDom();
|
|
11930
11941
|
for (const plugin of this.config.plugins || []) {
|
|
11931
11942
|
if (plugin.getMirror) plugin.getMirror({ nodeMirror: this.mirror });
|
|
11932
11943
|
}
|
|
11933
|
-
|
|
11944
|
+
const flushHandler = () => {
|
|
11934
11945
|
if (this.usingVirtualDom) {
|
|
11935
11946
|
const replayerHandler = {
|
|
11936
11947
|
mirror: this.mirror,
|
|
@@ -12026,13 +12037,15 @@ class Replayer {
|
|
|
12026
12037
|
this.applySelection(this.lastSelectionData);
|
|
12027
12038
|
this.lastSelectionData = null;
|
|
12028
12039
|
}
|
|
12029
|
-
}
|
|
12030
|
-
this.
|
|
12040
|
+
};
|
|
12041
|
+
this.addEmitterHandler(ReplayerEvents.Flush, flushHandler);
|
|
12042
|
+
const playBackHandler = () => {
|
|
12031
12043
|
this.firstFullSnapshot = null;
|
|
12032
12044
|
this.mirror.reset();
|
|
12033
12045
|
this.styleMirror.reset();
|
|
12034
12046
|
this.mediaManager.reset();
|
|
12035
|
-
}
|
|
12047
|
+
};
|
|
12048
|
+
this.addEmitterHandler(ReplayerEvents.PlayBack, playBackHandler);
|
|
12036
12049
|
const timer = new Timer([], {
|
|
12037
12050
|
speed: this.config.speed
|
|
12038
12051
|
});
|
|
@@ -12056,7 +12069,7 @@ class Replayer {
|
|
|
12056
12069
|
}
|
|
12057
12070
|
);
|
|
12058
12071
|
this.service.start();
|
|
12059
|
-
this.service.subscribe((state) => {
|
|
12072
|
+
this.serviceSubscription = this.service.subscribe((state) => {
|
|
12060
12073
|
this.emitter.emit(ReplayerEvents.StateChange, {
|
|
12061
12074
|
player: state
|
|
12062
12075
|
});
|
|
@@ -12066,7 +12079,7 @@ class Replayer {
|
|
|
12066
12079
|
timer
|
|
12067
12080
|
});
|
|
12068
12081
|
this.speedService.start();
|
|
12069
|
-
this.speedService.subscribe((state) => {
|
|
12082
|
+
this.speedServiceSubscription = this.speedService.subscribe((state) => {
|
|
12070
12083
|
this.emitter.emit(ReplayerEvents.StateChange, {
|
|
12071
12084
|
speed: state
|
|
12072
12085
|
});
|
|
@@ -12086,7 +12099,7 @@ class Replayer {
|
|
|
12086
12099
|
);
|
|
12087
12100
|
if (firstMeta) {
|
|
12088
12101
|
const { width, height } = firstMeta.data;
|
|
12089
|
-
|
|
12102
|
+
this.addTimeout(() => {
|
|
12090
12103
|
this.emitter.emit(ReplayerEvents.Resize, {
|
|
12091
12104
|
width,
|
|
12092
12105
|
height
|
|
@@ -12094,7 +12107,7 @@ class Replayer {
|
|
|
12094
12107
|
}, 0);
|
|
12095
12108
|
}
|
|
12096
12109
|
if (firstFullsnapshot) {
|
|
12097
|
-
|
|
12110
|
+
this.addTimeout(() => {
|
|
12098
12111
|
var _a2;
|
|
12099
12112
|
if (this.firstFullSnapshot) {
|
|
12100
12113
|
return;
|
|
@@ -12123,6 +12136,24 @@ class Replayer {
|
|
|
12123
12136
|
this.emitter.off(event, handler);
|
|
12124
12137
|
return this;
|
|
12125
12138
|
}
|
|
12139
|
+
/**
|
|
12140
|
+
* Track emitter handlers for cleanup
|
|
12141
|
+
*/
|
|
12142
|
+
addEmitterHandler(event, handler) {
|
|
12143
|
+
this.emitter.on(event, handler);
|
|
12144
|
+
this.emitterHandlers.push({ event, handler });
|
|
12145
|
+
}
|
|
12146
|
+
/**
|
|
12147
|
+
* Track timeouts for cleanup
|
|
12148
|
+
*/
|
|
12149
|
+
addTimeout(callback, delay) {
|
|
12150
|
+
const timeout = setTimeout(() => {
|
|
12151
|
+
this.timeouts.delete(timeout);
|
|
12152
|
+
callback();
|
|
12153
|
+
}, delay);
|
|
12154
|
+
this.timeouts.add(timeout);
|
|
12155
|
+
return timeout;
|
|
12156
|
+
}
|
|
12126
12157
|
setConfig(config) {
|
|
12127
12158
|
Object.keys(config).forEach((key) => {
|
|
12128
12159
|
config[key];
|
|
@@ -12225,10 +12256,31 @@ class Replayer {
|
|
|
12225
12256
|
* Memory occupation can be released by removing all references to this replayer.
|
|
12226
12257
|
*/
|
|
12227
12258
|
destroy() {
|
|
12259
|
+
var _a2, _b2;
|
|
12260
|
+
if (!this.wrapper || !this.wrapper.parentNode) {
|
|
12261
|
+
return;
|
|
12262
|
+
}
|
|
12228
12263
|
this.pause();
|
|
12264
|
+
this.emitterHandlers.forEach(({ event, handler }) => {
|
|
12265
|
+
this.emitter.off(event, handler);
|
|
12266
|
+
});
|
|
12267
|
+
this.emitterHandlers = [];
|
|
12268
|
+
(_a2 = this.serviceSubscription) == null ? void 0 : _a2.unsubscribe();
|
|
12269
|
+
(_b2 = this.speedServiceSubscription) == null ? void 0 : _b2.unsubscribe();
|
|
12270
|
+
this.serviceSubscription = void 0;
|
|
12271
|
+
this.speedServiceSubscription = void 0;
|
|
12272
|
+
this.timeouts.forEach((timeout) => clearTimeout(timeout));
|
|
12273
|
+
this.timeouts.clear();
|
|
12274
|
+
this.styleSheetLoadListeners.forEach((handler, element2) => {
|
|
12275
|
+
element2.removeEventListener("load", handler);
|
|
12276
|
+
});
|
|
12277
|
+
this.styleSheetLoadListeners.clear();
|
|
12278
|
+
this.imageMap.clear();
|
|
12279
|
+
this.canvasEventMap.clear();
|
|
12229
12280
|
this.mirror.reset();
|
|
12230
12281
|
this.styleMirror.reset();
|
|
12231
12282
|
this.mediaManager.reset();
|
|
12283
|
+
this.resetCache();
|
|
12232
12284
|
this.config.root.removeChild(this.wrapper);
|
|
12233
12285
|
this.emitter.emit(ReplayerEvents.Destroy);
|
|
12234
12286
|
}
|