lib/event-dispatcher.js
function once(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];
    }
    let deferred = DeferredPromise();
    for (let i = 0; i < eventNamesOrPatterns.length; i++) {
      buckets.push({
        pattern: ensureRegExp(eventNamesOrPatterns[i]),
        handler: handler,
        once: deferred
      });
    }
    return deferred.promise;
  }
function once(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];
    }
    let deferred = DeferredPromise();
    for (let i = 0; i < eventNamesOrPatterns.length; i++) {
      buckets.push({
        pattern: ensureRegExp(eventNamesOrPatterns[i]),
        handler: handler,
        once: deferred
      });
    }
    return deferred.promise;
  }
function once ( 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 ] ; } let deferred = DeferredPromise ( ) ; for ( let i = 0 ; i < eventNamesOrPatterns . length ; i ++ ) { buckets . push ( { pattern : ensureRegExp ( eventNamesOrPatterns [ i ] ) , handler : handler , once : deferred } ) ; } return deferred . promise ; }
Subscribe to an event for one event only

@public
@method
@param {String|RegEx|Array} eventNamesOrPatterns - name(s) of event, or pattern(s) for RegEx matching (required)
@param {Function} handler - event handler (required)
@returns {Promise} a promise that is fulfilled when the event has been processed
Subscribe to an event for one event only