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