Skip to content

Commit 4dded10

Browse files
committed
working
1 parent 7ca8632 commit 4dded10

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/rrweb/src/replay/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class Replayer {
134134
private mouseTail: HTMLCanvasElement | null = null;
135135
private tailPositions: Array<{ x: number; y: number }> = [];
136136

137-
private emitter: Emitter = mitt();
137+
private emitter: Emitter = mitt() as Emitter;
138138

139139
private nextUserInteractionEvent: eventWithTime | null;
140140

@@ -331,6 +331,8 @@ export class Replayer {
331331
this.applySelection(this.lastSelectionData);
332332
this.lastSelectionData = null;
333333
}
334+
335+
this.emitter.emit(ReplayerEvents.FlushEnd);
334336
});
335337
this.emitter.on(ReplayerEvents.PlayBack, () => {
336338
this.firstFullSnapshot = null;
@@ -577,6 +579,7 @@ export class Replayer {
577579
this.mediaManager.reset();
578580
this.config.root.removeChild(this.wrapper);
579581
this.emitter.emit(ReplayerEvents.Destroy);
582+
this.emitter.all.clear();
580583
}
581584

582585
public startLive(baselineTime?: number) {

packages/types/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ export type Emitter = {
651651
on(type: string, handler: Handler): void;
652652
emit(type: string, event?: unknown): void;
653653
off(type: string, handler: Handler): void;
654+
all: Map<string | symbol, Handler[]>;
654655
};
655656

656657
export type Arguments<T> = T extends (...payload: infer U) => unknown
@@ -675,6 +676,7 @@ export enum ReplayerEvents {
675676
EventCast = 'event-cast',
676677
CustomEvent = 'custom-event',
677678
Flush = 'flush',
679+
FlushEnd = 'flush-end',
678680
StateChange = 'state-change',
679681
PlayBack = 'play-back',
680682
Destroy = 'destroy',

0 commit comments

Comments
 (0)