emit speed with skip event

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 46f211e579
commit 68abd28c0a

View File

@@ -205,8 +205,9 @@ export class Replayer {
this.applyIncremental(event, isSync); this.applyIncremental(event, isSync);
if (event === this.nextUserInteractionEvent) { if (event === this.nextUserInteractionEvent) {
this.nextUserInteractionEvent = null; this.nextUserInteractionEvent = null;
this.setConfig({ speed: this.noramlSpeed }); const payload = { speed: this.noramlSpeed };
this.emitter.emit('skip-end'); this.setConfig(payload);
this.emitter.emit('skip-end', payload);
} }
if (this.config.skipInactive && !this.nextUserInteractionEvent) { if (this.config.skipInactive && !this.nextUserInteractionEvent) {
for (const _event of this.events) { for (const _event of this.events) {
@@ -227,10 +228,11 @@ export class Replayer {
this.noramlSpeed = this.config.speed; this.noramlSpeed = this.config.speed;
const skipTime = const skipTime =
this.nextUserInteractionEvent.delay! - event.delay!; this.nextUserInteractionEvent.delay! - event.delay!;
this.setConfig({ const payload = {
speed: Math.round(skipTime / SKIP_TIME_INTERVAL), speed: Math.round(skipTime / SKIP_TIME_INTERVAL),
}); };
this.emitter.emit('skip-start'); this.setConfig(payload);
this.emitter.emit('skip-start', payload);
} }
} }
}; };