How to use the flux.Dispatcher.prototype function in flux

To help you get started, we’ve selected a few flux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zanata / zanata-platform / frontend / src / main / web / lib / dispatchers / UserMatrixDispatcher.js View on Github external
import assign from 'object-assign';
import {Dispatcher} from 'flux';

var UserMatrixDispatcher = assign({}, new Dispatcher(), Dispatcher.prototype, {

  /**
   * A bridge function between the views and the dispatcher, marking the action
   * as a view action.  Another variant here could be handleServerAction.
   * @param  {object} action The data coming from the view.
   */
  handleViewAction: function(action) {
    this.dispatch({
      source: 'VIEW_ACTION',
      action: action
    });
  }
});

export default UserMatrixDispatcher;
github selfhub / selfhub / client / js / dispatchers / app_dispatcher.js View on Github external
var Dispatcher = require('flux').Dispatcher;
var merge = require('../../node_modules/react/lib/merge');
var PayloadSources = require('../constants/app_constants').PayloadSources;

var AppDispatcher = merge(Dispatcher.prototype, {
  handleServerAction: function(action) {
    this.dispatch({
      source: PayloadSources.SERVER_ACTION,
      action: action
    });
  },
  handleViewAction: function(action) {
    this.dispatch({
      source: PayloadSources.VIEW_ACTION,
      action: action
    });
  }
});

module.exports = AppDispatcher;
github everplans / fluxxed_up / src / lib / fu-dispatcher.js View on Github external
dispatch(action) {
    invariant(action.actionType, 'action type is undefined.')
    Dispatcher.prototype.dispatch.call(this, action)
  }
})