@posthog/rrweb-player 0.0.25 → 0.0.27
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 +55 -9
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +55 -9
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +55 -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
|
@@ -11772,6 +11772,11 @@ class Replayer {
|
|
|
11772
11772
|
__publicField2(this, "lastSelectionData", null);
|
|
11773
11773
|
__publicField2(this, "constructedStyleMutations", []);
|
|
11774
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());
|
|
11775
11780
|
__publicField2(this, "handleResize", (dimension) => {
|
|
11776
11781
|
this.iframe.style.display = "inherit";
|
|
11777
11782
|
for (const el of [this.mouseTail, this.iframe]) {
|
|
@@ -11931,12 +11936,12 @@ class Replayer {
|
|
|
11931
11936
|
this.handleResize = this.handleResize.bind(this);
|
|
11932
11937
|
this.getCastFn = this.getCastFn.bind(this);
|
|
11933
11938
|
this.applyEventsSynchronously = this.applyEventsSynchronously.bind(this);
|
|
11934
|
-
this.
|
|
11939
|
+
this.addEmitterHandler(ReplayerEvents.Resize, this.handleResize);
|
|
11935
11940
|
this.setupDom();
|
|
11936
11941
|
for (const plugin of this.config.plugins || []) {
|
|
11937
11942
|
if (plugin.getMirror) plugin.getMirror({ nodeMirror: this.mirror });
|
|
11938
11943
|
}
|
|
11939
|
-
|
|
11944
|
+
const flushHandler = () => {
|
|
11940
11945
|
if (this.usingVirtualDom) {
|
|
11941
11946
|
const replayerHandler = {
|
|
11942
11947
|
mirror: this.mirror,
|
|
@@ -12032,13 +12037,15 @@ class Replayer {
|
|
|
12032
12037
|
this.applySelection(this.lastSelectionData);
|
|
12033
12038
|
this.lastSelectionData = null;
|
|
12034
12039
|
}
|
|
12035
|
-
}
|
|
12036
|
-
this.
|
|
12040
|
+
};
|
|
12041
|
+
this.addEmitterHandler(ReplayerEvents.Flush, flushHandler);
|
|
12042
|
+
const playBackHandler = () => {
|
|
12037
12043
|
this.firstFullSnapshot = null;
|
|
12038
12044
|
this.mirror.reset();
|
|
12039
12045
|
this.styleMirror.reset();
|
|
12040
12046
|
this.mediaManager.reset();
|
|
12041
|
-
}
|
|
12047
|
+
};
|
|
12048
|
+
this.addEmitterHandler(ReplayerEvents.PlayBack, playBackHandler);
|
|
12042
12049
|
const timer = new Timer([], {
|
|
12043
12050
|
speed: this.config.speed
|
|
12044
12051
|
});
|
|
@@ -12062,7 +12069,7 @@ class Replayer {
|
|
|
12062
12069
|
}
|
|
12063
12070
|
);
|
|
12064
12071
|
this.service.start();
|
|
12065
|
-
this.service.subscribe((state) => {
|
|
12072
|
+
this.serviceSubscription = this.service.subscribe((state) => {
|
|
12066
12073
|
this.emitter.emit(ReplayerEvents.StateChange, {
|
|
12067
12074
|
player: state
|
|
12068
12075
|
});
|
|
@@ -12072,7 +12079,7 @@ class Replayer {
|
|
|
12072
12079
|
timer
|
|
12073
12080
|
});
|
|
12074
12081
|
this.speedService.start();
|
|
12075
|
-
this.speedService.subscribe((state) => {
|
|
12082
|
+
this.speedServiceSubscription = this.speedService.subscribe((state) => {
|
|
12076
12083
|
this.emitter.emit(ReplayerEvents.StateChange, {
|
|
12077
12084
|
speed: state
|
|
12078
12085
|
});
|
|
@@ -12092,7 +12099,7 @@ class Replayer {
|
|
|
12092
12099
|
);
|
|
12093
12100
|
if (firstMeta) {
|
|
12094
12101
|
const { width, height } = firstMeta.data;
|
|
12095
|
-
|
|
12102
|
+
this.addTimeout(() => {
|
|
12096
12103
|
this.emitter.emit(ReplayerEvents.Resize, {
|
|
12097
12104
|
width,
|
|
12098
12105
|
height
|
|
@@ -12100,7 +12107,7 @@ class Replayer {
|
|
|
12100
12107
|
}, 0);
|
|
12101
12108
|
}
|
|
12102
12109
|
if (firstFullsnapshot) {
|
|
12103
|
-
|
|
12110
|
+
this.addTimeout(() => {
|
|
12104
12111
|
var _a2;
|
|
12105
12112
|
if (this.firstFullSnapshot) {
|
|
12106
12113
|
return;
|
|
@@ -12129,6 +12136,24 @@ class Replayer {
|
|
|
12129
12136
|
this.emitter.off(event, handler);
|
|
12130
12137
|
return this;
|
|
12131
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
|
+
}
|
|
12132
12157
|
setConfig(config) {
|
|
12133
12158
|
Object.keys(config).forEach((key) => {
|
|
12134
12159
|
config[key];
|
|
@@ -12231,10 +12256,31 @@ class Replayer {
|
|
|
12231
12256
|
* Memory occupation can be released by removing all references to this replayer.
|
|
12232
12257
|
*/
|
|
12233
12258
|
destroy() {
|
|
12259
|
+
var _a2, _b2;
|
|
12260
|
+
if (!this.wrapper || !this.wrapper.parentNode) {
|
|
12261
|
+
return;
|
|
12262
|
+
}
|
|
12234
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();
|
|
12235
12280
|
this.mirror.reset();
|
|
12236
12281
|
this.styleMirror.reset();
|
|
12237
12282
|
this.mediaManager.reset();
|
|
12283
|
+
this.resetCache();
|
|
12238
12284
|
this.config.root.removeChild(this.wrapper);
|
|
12239
12285
|
this.emitter.emit(ReplayerEvents.Destroy);
|
|
12240
12286
|
}
|