Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
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;
dispatch(action) {
invariant(action.actionType, 'action type is undefined.')
Dispatcher.prototype.dispatch.call(this, action)
}
})