mirror of
https://github.com/nasa/openmct.git
synced 2025-01-02 11:26:42 +00:00
[Time Conductor] Cancel requests
Don't callback for any telemetry requests from a TelemetryHandle if the handle has been destroyed.
This commit is contained in:
parent
f7f6b8d612
commit
5940f94644
@ -39,6 +39,7 @@ define(
|
|||||||
*/
|
*/
|
||||||
function TelemetryHandle($q, subscription) {
|
function TelemetryHandle($q, subscription) {
|
||||||
var seriesMap = {},
|
var seriesMap = {},
|
||||||
|
active = true,
|
||||||
self = Object.create(subscription);
|
self = Object.create(subscription);
|
||||||
|
|
||||||
// Request a telemetry series for this specific object
|
// Request a telemetry series for this specific object
|
||||||
@ -50,7 +51,7 @@ define(
|
|||||||
// Store it for subsequent lookup
|
// Store it for subsequent lookup
|
||||||
seriesMap[id] = series;
|
seriesMap[id] = series;
|
||||||
// Notify callback of new series data, if there is one
|
// Notify callback of new series data, if there is one
|
||||||
if (callback) {
|
if (callback && active) {
|
||||||
callback(telemetryObject, series);
|
callback(telemetryObject, series);
|
||||||
}
|
}
|
||||||
// Pass it along for promise-chaining
|
// Pass it along for promise-chaining
|
||||||
@ -61,6 +62,10 @@ define(
|
|||||||
return telemetry.requestData(request).then(receiveSeries);
|
return telemetry.requestData(request).then(receiveSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.unsubscribe = function () {
|
||||||
|
active = false;
|
||||||
|
return subscription.unsubscribe();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the most recently obtained telemetry data series associated
|
* Get the most recently obtained telemetry data series associated
|
||||||
|
Loading…
Reference in New Issue
Block a user