function on (eventName, callback, priority = null) {
  if (typeof eventName !== 'string') {
    throw new TypeError('eventName must be a string when registering a listener');
  }
  if (!inArray(eventName, SUPPORTED_EVENTS)) {
    const events = SUPPORTED_EVENTS.join(', ');
    throw new Error(`"${eventName}" is not a valid event; must be one of: ${events}.`);
  }
  if (typeof callback !== 'function') {
    throw new TypeError('callback must be a function when registering a listener');
  }
  /* istanbul ignore if: internal argument */
  if (priority && priority !== prioritySymbol) {
    throw new TypeError('invalid priority parameter');
  }

  const listeners = config._event_listeners[eventName] || (config._event_listeners[eventName] = []);

  // Don't register the same callback more than once
  if (!inArray(callback, listeners)) {
    if (priority === prioritySymbol) {
      listeners.unshift(callback);
    } else {
      listeners.push(callback);
    }

    if (config._event_memory[eventName] !== undefined) {
      callback(config._event_memory[eventName]);
    }
  }
}
Registers a callback as a listener to the specified event.

@public
@method on
@param {string} eventName
@param {Function} callback
@param {Object} [priority] Internal parameter for PerfReporter
@return {void}