re-use live mode config - and improve docs on how to start liveMode (#1003)
* Use config.liveMode to turn on liveMode in the timer * Discussion of `startLive(1500)` was incorrect as startLive is based on timestamps, not playback offsets. Also reorder to introduce `addEvent` earlier Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
This commit is contained in:
@@ -262,7 +262,10 @@ export class Replayer {
|
||||
this.mirror.reset();
|
||||
});
|
||||
|
||||
const timer = new Timer([], config?.speed || defaultConfig.speed);
|
||||
const timer = new Timer([], {
|
||||
speed: this.config.speed,
|
||||
liveMode: this.config.liveMode,
|
||||
});
|
||||
this.service = createPlayerService(
|
||||
{
|
||||
events: events
|
||||
|
||||
@@ -13,9 +13,16 @@ export class Timer {
|
||||
private raf: number | null = null;
|
||||
private liveMode: boolean;
|
||||
|
||||
constructor(actions: actionWithDelay[] = [], speed: number) {
|
||||
constructor(
|
||||
actions: actionWithDelay[] = [],
|
||||
config: {
|
||||
speed: number;
|
||||
liveMode: boolean;
|
||||
},
|
||||
) {
|
||||
this.actions = actions;
|
||||
this.speed = speed;
|
||||
this.speed = config.speed;
|
||||
this.liveMode = config.liveMode;
|
||||
}
|
||||
/**
|
||||
* Add an action after the timer starts.
|
||||
|
||||
Reference in New Issue
Block a user