Skip to content

Instantly share code, notes, and snippets.

@ALF-er
Created May 17, 2015 14:10
Show Gist options
  • Save ALF-er/d604536b170dba72a43a to your computer and use it in GitHub Desktop.
Save ALF-er/d604536b170dba72a43a to your computer and use it in GitHub Desktop.
rhcedispatcher.js
import { Dispatcher } from "flux";
import assign from "react/lib/Object.assign";
import { PayloadSources } from "constants/AppConstants";
export default assign(new Dispatcher(), {
handleServerAction(type, result, error = null) {
let payload = {
source: PayloadSources.SERVER_ACTION,
action: {
type,
error,
result
}
};
this.dispatch(payload);
console.log(type, payload);
},
handleAppAction(type, result, error = null) {
var payload = {
source: PayloadSources.APP_ACTION,
action: {
type,
error,
result
}
};
this.dispatch(payload);
console.log(type, payload);
},
handleViewAction(type, result, error = null) {
var payload = {
source: PayloadSources.VIEW_ACTION,
action: {
type,
error,
result
}
};
this.dispatch(payload);
console.log(type, payload);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment