[Telemetry] Update TelemetryProvider API

Based on feedback from tutorial sprint, update provider API,
formatter API, and legacy adapter code.

Providers can now implement separate checks for providing realtime
and historical data, and providers are not registered with a specific
strategy.  Strategy is instead intended to be an attribute in the
request options.

Removed unused code in the telemetry API and simplify limitEvaluators.
This commit is contained in:
Pete Richards
2017-02-21 11:37:09 -08:00
parent 8e13819e1e
commit d9f8622459
3 changed files with 99 additions and 149 deletions

View File

@ -28,6 +28,18 @@ define([
// TODO: needs reference to formatService;
function TelemetryValueFormatter(valueMetadata, formatService) {
var numberFormatter = {
parse: function (x) {
return Number(x);
},
format: function (x) {
return x;
},
validate: function (x) {
return true;
}
};
this.valueMetadata = valueMetadata;
this.parseCache = new WeakMap();
this.formatCache = new WeakMap();
@ -36,17 +48,7 @@ define([
.getFormat(valueMetadata.format, valueMetadata);
} catch (e) {
// TODO: Better formatting
this.formatter = {
parse: function (x) {
return Number(x);
},
format: function (x) {
return x;
},
validate: function (x) {
return true;
}
};
this.formatter = numberFormatter;
}
if (valueMetadata.type === 'enum') {