[Code Style] Use prototypes in Scrolling List bundle

WTD-1482.
This commit is contained in:
Victor Woeltjen
2015-08-13 12:35:48 -07:00
parent 820c15d74c
commit 6302eee17e
5 changed files with 189 additions and 191 deletions

View File

@ -34,6 +34,7 @@ define(
* (typically, measurements.) Used by the ScrollingListController.
*
* @memberof platform/features/scrolling
* @implements {platform/features/scrolling.ScrollingColumn}
* @constructor
* @param rangeMetadata an object with the machine- and human-
* readable names for this range (in `key` and `name`
@ -42,35 +43,26 @@ define(
* formatting service, for making values human-readable.
*/
function RangeColumn(rangeMetadata, telemetryFormatter) {
return {
/**
* Get the title to display in this column's header.
* @returns {string} the title to display
* @memberof platform/features/scrolling.RangeColumn#
*/
getTitle: function () {
return rangeMetadata.name;
},
/**
* Get the text to display inside a row under this
* column.
* @returns {string} the text to display
* @memberof platform/features/scrolling.RangeColumn#
*/
getValue: function (domainObject, datum) {
var range = rangeMetadata.key,
limit = domainObject.getCapability('limit'),
value = datum[range],
alarm = limit.evaluate(datum, range);
return {
cssClass: alarm && alarm.cssClass,
text: telemetryFormatter.formatRangeValue(value)
};
}
};
this.rangeMetadata = rangeMetadata;
this.telemetryFormatter = telemetryFormatter;
}
RangeColumn.prototype.getTitle = function () {
return this.rangeMetadata.name;
};
RangeColumn.prototype.getValue = function (domainObject, datum) {
var range = this.rangeMetadata.key,
limit = domainObject.getCapability('limit'),
value = datum[range],
alarm = limit.evaluate(datum, range);
return {
cssClass: alarm && alarm.cssClass,
text: this.telemetryFormatter.formatRangeValue(value)
};
};
return RangeColumn;
}
);