mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 00:45:41 +00:00
tidy up condition manager use in telemetry provider
This commit is contained in:
parent
7a4b967a01
commit
49ff0c79db
@ -18,19 +18,24 @@ export default class ConditionSetTelemetryProvider {
|
||||
}
|
||||
|
||||
request(domainObject, options) {
|
||||
const conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||
let conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||
|
||||
return conditionManager.requestLADConditionSetOutput()
|
||||
.then(latestOutput => { return latestOutput ? [latestOutput] : []; });
|
||||
.then(latestOutput => {
|
||||
conditionManager.destroy();
|
||||
conditionManager = undefined;
|
||||
return latestOutput ? [latestOutput] : [];
|
||||
});
|
||||
}
|
||||
|
||||
subscribe(domainObject, callback) {
|
||||
const conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||
let conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||
conditionManager.on('conditionSetResultUpdated', callback);
|
||||
|
||||
return function unsubscribe() {
|
||||
return () => { // unsubscribe function
|
||||
conditionManager.off('conditionSetResultUpdated');
|
||||
conditionManager.destroy();
|
||||
}
|
||||
conditionManager = undefined;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user