lib/dispatcher.js
function (events, context) {
    if (!_.isObject(events)) {
      console.warn('Only registration objects can be passed to dispatcher.register()');
      return;
    }

    return this.dispatcher.register(function (payload) {
      // Switch statements be damned...
      if (events[payload.type]) {
        events[payload.type].apply(context || null, [payload.data]);
      }
    });
  }
function (events, context) {
    if (!_.isObject(events)) {
      console.warn('Only registration objects can be passed to dispatcher.register()');
      return;
    }

    return this.dispatcher.register(function (payload) {
      // Switch statements be damned...
      if (events[payload.type]) {
        events[payload.type].apply(context || null, [payload.data]);
      }
    });
  }
function ( events , context ) { if ( ! _ . isObject ( events ) ) { console . warn ( 'Only registration objects can be passed to dispatcher.register()' ) ; return ; } return this . dispatcher . register ( function ( payload ) { // Switch statements be damned... if ( events [ payload . type ] ) { events [ payload . type ] . apply ( context || null , [ payload . data ] ) ; } } ) ; }
Register a collection of callbacks to action types
@param {Object} events - A mapping of action types to callbacks
@param {Object} [context=null] - The context applied to the callback
@returns {string} The dispatcher token to use for unregister or waitFor
Register a collection of callbacks to action types