[Indicators] Add notion of indicators
Add indicators as a category-of-extension, utilized from the bottom bar to populate its contents. WTD-608.
This commit is contained in:
36
platform/commonUI/general/src/BottomBarController.js
Normal file
36
platform/commonUI/general/src/BottomBarController.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Controller for the bottombar template. Exposes
|
||||
* available indicators (of extension category "indicators")
|
||||
* @constructor
|
||||
*/
|
||||
function BottomBarController(indicators) {
|
||||
// Utility function used to instantiate indicators
|
||||
// from their injected constructors.
|
||||
function instantiate(Indicator) {
|
||||
return new Indicator();
|
||||
}
|
||||
|
||||
indicators = indicators.map(instantiate);
|
||||
|
||||
return {
|
||||
/**
|
||||
* Get all indicators to display.
|
||||
* @returns {Indicator[]} all indicators
|
||||
* to display in the bottom bar.
|
||||
*/
|
||||
getIndicators: function () {
|
||||
return indicators;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return BottomBarController;
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user