lib/event-dispatcher.js
function on(eventNamesOrPatterns, handler) {
    if (!eventNamesOrPatterns) {
      throw new Error('Must pass at least one event name or matching RegEx');
    }
    assert.func(handler, 'handler');
    if (!Array.isArray(eventNamesOrPatterns)) {
      eventNamesOrPatterns = [eventNamesOrPatterns];
    }
    for (let i = 0; i < eventNamesOrPatterns.length; i++) {
      buckets.push({
        pattern: ensureRegExp(eventNamesOrPatterns[i]),
        handler: handler
      });
    }
  }
function on(eventNamesOrPatterns, handler) {
    if (!eventNamesOrPatterns) {
      throw new Error('Must pass at least one event name or matching RegEx');
    }
    assert.func(handler, 'handler');
    if (!Array.isArray(eventNamesOrPatterns)) {
      eventNamesOrPatterns = [eventNamesOrPatterns];
    }
    for (let i = 0; i < eventNamesOrPatterns.length; i++) {
      buckets.push({
        pattern: ensureRegExp(eventNamesOrPatterns[i]),
        handler: handler
      });
    }
  }
function on ( eventNamesOrPatterns , handler ) { if ( ! eventNamesOrPatterns ) { throw new Error ( 'Must pass at least one event name or matching RegEx' ) ; } assert . func ( handler , 'handler' ) ; if ( ! Array . isArray ( eventNamesOrPatterns ) ) { eventNamesOrPatterns = [ eventNamesOrPatterns ] ; } for ( let i = 0 ; i < eventNamesOrPatterns . length ; i ++ ) { buckets . push ( { pattern : ensureRegExp ( eventNamesOrPatterns [ i ] ) , handler : handler } ) ; } }
Subscribe to an event

@public
@method
@param {String|RegEx|Array} eventNamesOrPatterns - name(s) of event, or pattern(s) for RegEx matching (required)
@param {Function} handler - event handler (required)
Subscribe to an event