src/dubtrack.js
function _createEventDispatcher(internalEventName, translator, globalObject) {
    return function(event) {
        var handlers = this.eventHandlers[internalEventName];

        if (!translator) {
            LOG.error("Could not find a translator for internalEventName {}", internalEventName);
            return;
        }

        var internalObject = translator(event);

        if (!internalObject) {
            return;
        }

        internalObject.eventName = internalEventName;

        for (var i = 0; i < handlers.length; i++) {
            handlers[i].callback.call(handlers[i].context, internalObject, globalObject);
        }
    };
}
function _createEventDispatcher(internalEventName, translator, globalObject) {
    return function(event) {
        var handlers = this.eventHandlers[internalEventName];

        if (!translator) {
            LOG.error("Could not find a translator for internalEventName {}", internalEventName);
            return;
        }

        var internalObject = translator(event);

        if (!internalObject) {
            return;
        }

        internalObject.eventName = internalEventName;

        for (var i = 0; i < handlers.length; i++) {
            handlers[i].callback.call(handlers[i].context, internalObject, globalObject);
        }
    };
}
function _createEventDispatcher ( internalEventName , translator , globalObject ) { return function ( event ) { var handlers = this . eventHandlers [ internalEventName ] ; if ( ! translator ) { LOG . error ( "Could not find a translator for internalEventName {}" , internalEventName ) ; return ; } var internalObject = translator ( event ) ; if ( ! internalObject ) { return ; } internalObject . eventName = internalEventName ; for ( var i = 0 ; i < handlers . length ; i ++ ) { handlers [ i ] . callback . call ( handlers [ i ] . context , internalObject , globalObject ) ; } } ; }
Creates a function which dispatches the given event to its listeners.

@param {string} internalEventName - The event name from the Event enum
@param {function} translator - A function which translates from the DubAPI event to an internal model
@param {object} globalObject - The object representing global application state
@returns {function} An event dispatcher function appropriate to the event
Creates a function which dispatches the given event to its listeners .