[Telemetry] Keep telemetryObjects reference

Return the same value from getTelemetryObjects if thes e
haven't changed, to permit this return value to be
watched directly without appearing unstable. Supports
the addition of stacked plot controls, which need
to be conditioned on the number of telemetry objects
present. WTD-625.
This commit is contained in:
Victor Woeltjen 2014-12-10 18:28:38 -08:00
parent 03179284f4
commit 4173dd748b

View File

@ -45,7 +45,11 @@ define(
// Used to track whether a new telemetryUpdate
// is being issued.
broadcasting: false
broadcasting: false,
// Used for getTelemetryObjects; a reference is
// stored so that this can be called in a watch
telemetryObjects: []
};
// Broadcast that a telemetryUpdate has occurred.
@ -182,6 +186,9 @@ define(
// Build the containers
domainObjects.forEach(buildResponseContainer);
// Store the reference to support getTelemetryObjects
self.telemetryObjects = domainObjects;
// Maintain a list of relevant ids, to convert
// back from dictionary-like container objects to arrays.
self.ids = domainObjects.map(function (obj) {
@ -259,9 +266,7 @@ define(
* @returns {DomainObject[]} an array of metadata objects
*/
getTelemetryObjects: function () {
return self.ids.map(function (id) {
return self.response[id].domainObject;
});
return self.telemetryObjects;
},
/**
* Get the latest telemetry response for a specific