From d0c31bb4cfdca6635187e084fc296eff118fb497 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] close #153 emit event when it being casted --- src/replay/index.ts | 8 +++++++- src/types.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 8d0230a9..b67c2f4c 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -131,7 +131,13 @@ export class Replayer { if (isSync) { castFn(); } else { - actions.push({ doAction: castFn, delay: this.getDelay(event) }); + actions.push({ + doAction: () => { + castFn(); + this.emitter.emit(ReplayerEvents.EventCast, event); + }, + delay: this.getDelay(event), + }); } } this.timer.addActions(actions); diff --git a/src/types.ts b/src/types.ts index 44621399..e1efafa2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -313,4 +313,5 @@ export enum ReplayerEvents { SkipStart = 'skip-start', SkipEnd = 'skip-end', MouseInteraction = 'mouse-interaction', + EventCast = 'event-cast', }