mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 16:49:41 +00:00
feat: allow add time to aux timer
This commit is contained in:
committed by
Carlos Valente
parent
7dec32aea7
commit
1e8706aa73
@@ -241,6 +241,11 @@ const actionHandlers: Record<string, ActionHandler> = {
|
|||||||
const timeInMs = numberOrError(command.duration) * 1000;
|
const timeInMs = numberOrError(command.duration) * 1000;
|
||||||
reply.payload = auxTimerService.setTime(timeInMs);
|
reply.payload = auxTimerService.setTime(timeInMs);
|
||||||
}
|
}
|
||||||
|
if ('addtime' in command) {
|
||||||
|
// convert addTime in seconds to ms
|
||||||
|
const timeInMs = numberOrError(command.addtime) * 1000;
|
||||||
|
reply.payload = auxTimerService.addTime(timeInMs);
|
||||||
|
}
|
||||||
if ('direction' in command) {
|
if ('direction' in command) {
|
||||||
if (command.direction === SimpleDirection.CountUp || command.direction === SimpleDirection.CountDown) {
|
if (command.direction === SimpleDirection.CountUp || command.direction === SimpleDirection.CountDown) {
|
||||||
reply.payload = auxTimerService.setDirection(command.direction);
|
reply.payload = auxTimerService.setDirection(command.direction);
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ export class AuxTimerService {
|
|||||||
return this.timer.setTime(duration);
|
return this.timer.setTime(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@broadcastReturn
|
||||||
|
addTime(millis: number) {
|
||||||
|
return this.timer.setTime(this.timer.state.current + millis);
|
||||||
|
}
|
||||||
|
|
||||||
@broadcastReturn
|
@broadcastReturn
|
||||||
private update() {
|
private update() {
|
||||||
return this.timer.update(this.getTime());
|
return this.timer.update(this.getTime());
|
||||||
|
|||||||
Reference in New Issue
Block a user