restore speed when finished
This commit is contained in:
@@ -70,6 +70,7 @@ export class Replayer {
|
|||||||
this.setConfig(Object.assign({}, config));
|
this.setConfig(Object.assign({}, config));
|
||||||
this.setupDom();
|
this.setupDom();
|
||||||
this.emitter.on('resize', this.handleResize as mitt.Handler);
|
this.emitter.on('resize', this.handleResize as mitt.Handler);
|
||||||
|
this.noramlSpeed = this.config.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public on(event: string, handler: mitt.Handler) {
|
public on(event: string, handler: mitt.Handler) {
|
||||||
@@ -209,9 +210,7 @@ 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;
|
||||||
const payload = { speed: this.noramlSpeed };
|
this.restoreSpeed();
|
||||||
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) {
|
||||||
@@ -249,6 +248,7 @@ export class Replayer {
|
|||||||
}
|
}
|
||||||
this.lastPlayedEvent = event;
|
this.lastPlayedEvent = event;
|
||||||
if (event === this.events[this.events.length - 1]) {
|
if (event === this.events[this.events.length - 1]) {
|
||||||
|
this.restoreSpeed();
|
||||||
this.emitter.emit('finish');
|
this.emitter.emit('finish');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -565,4 +565,10 @@ export class Replayer {
|
|||||||
event.data.source <= IncrementalSource.Input
|
event.data.source <= IncrementalSource.Input
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private restoreSpeed() {
|
||||||
|
const payload = { speed: this.noramlSpeed };
|
||||||
|
this.setConfig(payload);
|
||||||
|
this.emitter.emit('skip-end', payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user