mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +00:00
[Telemetry] Add telemetry subscriptions
Add ability to subscribe/unsubscribe to streaming telemetry updates. This may be more performant than polling in some circumstances, and appears necessary for good performance of autoflow tabular views, WTD-614.
This commit is contained in:
@ -38,6 +38,23 @@ define(
|
||||
})).then(mergeResults);
|
||||
}
|
||||
|
||||
// Subscribe to updates from all providers
|
||||
function subscribe(callback, requests) {
|
||||
var unsubscribes = telemetryProviders.map(function (provider) {
|
||||
return provider.subscribe(callback, requests);
|
||||
});
|
||||
|
||||
// Return an unsubscribe function that invokes unsubscribe
|
||||
// for all providers.
|
||||
return function () {
|
||||
unsubscribes.forEach(function (unsubscribe) {
|
||||
if (unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
* Request telemetry data.
|
||||
|
Reference in New Issue
Block a user