mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-09 00:09:15 +00:00
refract: broadcast state
- ability to broadcast state without recalculating timer
This commit is contained in:
@@ -203,8 +203,8 @@ export class EventTimer extends Timer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// broadcast state
|
// broadcast state
|
||||||
broadcastState() {
|
broadcastState(update = true) {
|
||||||
this.io.emit('timer', this.getObject());
|
this.io.emit('timer', this.getObject(update));
|
||||||
this.io.emit('playstate', this.state);
|
this.io.emit('playstate', this.state);
|
||||||
this.io.emit('selected', {
|
this.io.emit('selected', {
|
||||||
id: this.selectedEventId,
|
id: this.selectedEventId,
|
||||||
@@ -241,7 +241,12 @@ export class EventTimer extends Timer {
|
|||||||
this.current = this._finishAt - now;
|
this.current = this._finishAt - now;
|
||||||
} else {
|
} else {
|
||||||
// look for event if none is loaded
|
// look for event if none is loaded
|
||||||
if (this.current <= 0 || this.secondaryTimer <= 0) this.rollLoad();
|
if (this.current <= 0 || this.secondaryTimer <= 0) {
|
||||||
|
const newState = this.rollLoad();
|
||||||
|
|
||||||
|
// broadcast state without recalling timer
|
||||||
|
if (newState) this.broadcastState(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ export class Timer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getObject
|
// getObject
|
||||||
getObject() {
|
getObject(update = true) {
|
||||||
// update timer
|
// update timer
|
||||||
this.update();
|
if (update) this.update();
|
||||||
|
|
||||||
// update timetag
|
// update timetag
|
||||||
this.timeTag = stringFromMillis(this.current);
|
this.timeTag = stringFromMillis(this.current);
|
||||||
|
|||||||
Reference in New Issue
Block a user