mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
use existing var instead of recalculating
on listener should be off in destroy()
This commit is contained in:
parent
cbeb25c583
commit
aed5377ad2
@ -45,7 +45,6 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
this.input = telemetryDomainObjectDefinition.input;
|
||||
this.metadata = telemetryDomainObjectDefinition.metadata;
|
||||
this.telemetryObjectIdAsString = this.objectAPI.makeKeyString(this.telemetry);
|
||||
|
||||
this.on(`subscription:${this.telemetryObjectIdAsString}`, this.handleSubscription);
|
||||
this.objectAPI.get(this.telemetryObjectIdAsString).then((obj) => this.initialize(obj));
|
||||
}
|
||||
@ -129,7 +128,7 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
}
|
||||
);
|
||||
|
||||
return this.objectAPI.get(this.objectAPI.makeKeyString(this.telemetry))
|
||||
return this.objectAPI.get(this.telemetryObjectIdAsString)
|
||||
.then((obj) => {
|
||||
if (!obj || !this.isValid()) {
|
||||
return this.formatData({});
|
||||
@ -148,7 +147,7 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.on(`subscription:${this.telemetryObjectIdAsString}`, this.handleSubscription);
|
||||
this.off(`subscription:${this.telemetryObjectIdAsString}`, this.handleSubscription);
|
||||
this.emitEvent('criterionRemoved');
|
||||
delete this.telemetryObjectIdAsString;
|
||||
delete this.telemetryObject;
|
||||
|
Loading…
Reference in New Issue
Block a user