From 07cf74ca789b1b27954d088252bd1528077b993a Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] restore speed when finished --- src/replay/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 0e7ecb4e..6ca3efd4 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -70,6 +70,7 @@ export class Replayer { this.setConfig(Object.assign({}, config)); this.setupDom(); this.emitter.on('resize', this.handleResize as mitt.Handler); + this.noramlSpeed = this.config.speed; } public on(event: string, handler: mitt.Handler) { @@ -209,9 +210,7 @@ export class Replayer { this.applyIncremental(event, isSync); if (event === this.nextUserInteractionEvent) { this.nextUserInteractionEvent = null; - const payload = { speed: this.noramlSpeed }; - this.setConfig(payload); - this.emitter.emit('skip-end', payload); + this.restoreSpeed(); } if (this.config.skipInactive && !this.nextUserInteractionEvent) { for (const _event of this.events) { @@ -249,6 +248,7 @@ export class Replayer { } this.lastPlayedEvent = event; if (event === this.events[this.events.length - 1]) { + this.restoreSpeed(); this.emitter.emit('finish'); } }; @@ -565,4 +565,10 @@ export class Replayer { event.data.source <= IncrementalSource.Input ); } + + private restoreSpeed() { + const payload = { speed: this.noramlSpeed }; + this.setConfig(payload); + this.emitter.emit('skip-end', payload); + } }