Source: formatters/homeepgasset.js

define('application/formatters/homeepgasset', [
    'antie/iterator',
    'antie/runtimecontext',
    'application/formatters/epgasset'
], function (
    Iterator,
    RuntimeContext,
    EpgFormatter
) {
    'use strict';

    var layout = RuntimeContext.getCurrentApplication().getLayout().asset.epg,
        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,
                    bottomRightIcon: true,
                    asset: asset,
                    imageDimension: {
                        width: layout.image.width,
                        height: layout.image.height
                    }
                };

            return format.base.call(this, item, formatParams);
        }
    });
});