Skip to content

Instantly share code, notes, and snippets.

@KeKs0r
Created July 3, 2015 09:39
Show Gist options
  • Save KeKs0r/1473d2a118dd51732bf8 to your computer and use it in GitHub Desktop.
Save KeKs0r/1473d2a118dd51732bf8 to your computer and use it in GitHub Desktop.
More Verbose Flux Dispatcher for Marty
var Marty = require('marty');
export default class Application extends Marty.Application {
constructor(options) {
super(options);
}
// Custom Dispatcher verbose Dispatcher
var vomitify = function(f) {
return function() {
try {
// Does weirdStuff in binCallback
return f.apply(this, arguments);
} catch(e) {
console.error(e);
}
};
};
var dispatcher = this.dispatcher;
var proto = Object.getPrototypeOf(dispatcher);
dispatcher.register = function(f) {
proto.register.call(this, vomitify(f));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment