refactor: allow aux change direction while playing

This commit is contained in:
Carlos Valente
2024-10-04 14:00:06 +02:00
committed by Carlos Valente
parent 9a6ca7ac67
commit 16fd44a441
6 changed files with 92 additions and 21 deletions
@@ -2,6 +2,7 @@ import { SimpleDirection, SimpleTimerState } from 'ontime-types';
import { SimpleTimer } from '../../classes/simple-timer/SimpleTimer.js';
import { eventStore } from '../../stores/EventStore.js';
import { timerConfig } from '../../config/config.js';
export type EmitFn = (state: SimpleTimerState) => void;
export type GetTimeFn = () => number;
@@ -13,7 +14,7 @@ export class AuxTimerService {
private getTime: GetTimeFn;
constructor(emit: EmitFn, getTime: GetTimeFn) {
this.timer = new SimpleTimer();
this.timer = new SimpleTimer(timerConfig.auxTimerDefault);
this.emit = emit;
this.getTime = getTime;
}
@@ -30,7 +31,7 @@ export class AuxTimerService {
@broadcastReturn
setDirection(direction: SimpleDirection) {
return this.timer.setDirection(direction);
return this.timer.setDirection(direction, this.getTime());
}
@broadcastReturn