mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 09:25:29 +00:00
[Telemetry] Unsubscribe on composition change
WTD-1329.
This commit is contained in:
@ -154,6 +154,14 @@ define(
|
|||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unsubscribeAll() {
|
||||||
|
return unsubscribePromise.then(function (unsubscribes) {
|
||||||
|
return $q.all(unsubscribes.map(function (unsubscribe) {
|
||||||
|
return unsubscribe();
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
// Get a reference to relevant objects (those with telemetry
|
// Get a reference to relevant objects (those with telemetry
|
||||||
// capabilities) and subscribe to their telemetry updates.
|
// capabilities) and subscribe to their telemetry updates.
|
||||||
@ -176,7 +184,7 @@ define(
|
|||||||
function modelChange(model) {
|
function modelChange(model) {
|
||||||
if (!idsMatch((model || {}).composition || [])) {
|
if (!idsMatch((model || {}).composition || [])) {
|
||||||
// Reinitialize if composition has changed
|
// Reinitialize if composition has changed
|
||||||
initialize();
|
unsubscribeAll().then(initialize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,11 +209,7 @@ define(
|
|||||||
if (unlistenToMutation) {
|
if (unlistenToMutation) {
|
||||||
unlistenToMutation();
|
unlistenToMutation();
|
||||||
}
|
}
|
||||||
return unsubscribePromise.then(function (unsubscribes) {
|
return unsubscribeAll();
|
||||||
return $q.all(unsubscribes.map(function (unsubscribe) {
|
|
||||||
return unsubscribe();
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Get the most recent domain value that has been observed
|
* Get the most recent domain value that has been observed
|
||||||
|
Reference in New Issue
Block a user