Skip to content

Commit

Permalink
Switch staleness provider for SWG to use modeChanged instead of clock (
Browse files Browse the repository at this point in the history
…#6845)

* Switch staleness provider for SWG to use modeChanged instead of clock
  • Loading branch information
khalidadil authored Jul 28, 2023
1 parent 16e1ac2 commit 7c58b19
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions example/generator/SinewaveStalenessProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class SinewaveLimitProvider extends EventEmitter {
const id = this.#getObjectKeyString(domainObject);

if (this.#isRealTime === undefined) {
this.#updateRealTime(this.#openmct.time.clock());
this.#updateRealTime(this.#openmct.time.getMode());
}

this.#handleClockUpdate();
Expand Down Expand Up @@ -92,15 +92,15 @@ export default class SinewaveLimitProvider extends EventEmitter {

if (observers && !this.#watchingTheClock) {
this.#watchingTheClock = true;
this.#openmct.time.on('clock', this.#updateRealTime, this);
this.#openmct.time.on('modeChanged', this.#updateRealTime, this);
} else if (!observers && this.#watchingTheClock) {
this.#watchingTheClock = false;
this.#openmct.time.off('clock', this.#updateRealTime, this);
this.#openmct.time.off('modeChanged', this.#updateRealTime, this);
}
}

#updateRealTime(clock) {
this.#isRealTime = clock !== undefined;
#updateRealTime(mode) {
this.#isRealTime = mode !== 'fixed';

if (!this.#isRealTime) {
Object.keys(this.#observingStaleness).forEach((id) => {
Expand Down

0 comments on commit 7c58b19

Please # to comment.