Object based .register() syntax
yoshuawuyts opened this issue · comments
Yosh commented
Change the .register()
syntax to be something like:
dispatcher.register({
user: {
login: function() {},
logout: function() {}
},
course: {
create: function() {},
remove: function() {}
}
});
So the .dispatch() syntax should become something like:
dispatcher.dispatch('user.login', {foo: 'bar'});
Yosh commented
Or possibly:
dispatcher.dispatch('user_login', {foo: 'bar'});
Yosh commented
I've settled on merging barracks()
and .register()
:
var barracks = require('barracks');
var dispatcher = barracks({
user: {
login: function() {},
logout: function() {}
},
course: {
create: function() {},
remove: function() {}
}
});
dispatcher.dispatch('user_login', {foo: 'bar'});