I came across this in the wiki:
It is recommended that you divide your controller objects into smaller pieces of related functionality and have multiple routers / controllers, instead of just one giant router and controller.
I didn't understand how to apply this. Are there any examples or tutorials?
Right now, I'm playing with Marionette
and using require.js
. How would I go about implementing multiple routers and controllers?
I ended up with this in my "main.js":
MyApp.start();
new BlogRouter({
controller: new BlogController()
});
new NewsRouter({
controller: new NewsController()
});
Backbone.history.start();
I'm not sure if it's the right approach. But it's working. Hope it will help some newbies like me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With