define('application/formatters/sports', [
'antie/iterator',
'antie/runtimecontext',
'application/formatters/epgasset'
], function (
Iterator,
RuntimeContext,
EpgFormatter
) {
'use strict';
var layout = RuntimeContext.getCurrentApplication().getLayout().sports.asset,
PROGRAM_BROADCAST = {
PAST: -1,
LIVE: 0,
FUTURE: 1
};
return EpgFormatter.extend({
/**
* Formats the widget.
*
* @param {Object|Iterator} item - The item.
* @param {Object} [asset] - The asset item to be updated.
* @returns {Object} - The formatted widget.
*/
format: function format (item, asset) {
var start = new Date(item.getStartTime() * 1000),
end = new Date(item.getEndTime() * 1000),
isLive = this._getProgramBroadcast(start, end) === PROGRAM_BROADCAST.LIVE,
formatParams = {
width: layout.width,
height: layout.height,
progressbar: isLive,
asset: asset
};
return format.base.call(this, item, formatParams);
}
});
});