mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
Merge branch 'master' into wip/migratedb
This commit is contained in:
@@ -8,6 +8,7 @@ export class Timer {
|
||||
clock = null;
|
||||
duration = null;
|
||||
current = null;
|
||||
secondaryTimer = null;
|
||||
_finishAt = null;
|
||||
_finishedAt = null;
|
||||
_startedAt = null;
|
||||
@@ -50,6 +51,9 @@ export class Timer {
|
||||
// check playstate
|
||||
switch (this.state) {
|
||||
case 'start':
|
||||
// ensure we have a start time
|
||||
if (this._startedAt == null) this._startedAt = now;
|
||||
|
||||
// update current timer
|
||||
this.current =
|
||||
this._startedAt + this.duration + this._pausedTotal - now;
|
||||
@@ -110,8 +114,10 @@ export class Timer {
|
||||
);
|
||||
}
|
||||
|
||||
_resetTimers() {
|
||||
_resetTimers(total = false) {
|
||||
if (total) this.duration = null;
|
||||
this.current = this.duration;
|
||||
this.secondaryTimer = null;
|
||||
this._finishAt = null;
|
||||
this._finishedAt = null;
|
||||
this._startedAt = null;
|
||||
@@ -132,7 +138,7 @@ export class Timer {
|
||||
return {
|
||||
clock: this.clock,
|
||||
running: Timer.toSeconds(this.current),
|
||||
currentSeconds: Timer.toSeconds(Math.max(this.current, 0)),
|
||||
secondary: Timer.toSeconds(this.secondaryTimer),
|
||||
durationSeconds: Timer.toSeconds(this.duration),
|
||||
expectedFinish: this._getExpectedFinish(),
|
||||
startedAt: this._startedAt,
|
||||
|
||||
Reference in New Issue
Block a user