I have seen application starting Backbone.history in either addInitializer method or in "initialize:after" event. What are the advantages and disadvantages of starting Backbone.history in either of the places?
In my application, I want to render certain regions in the layout while the application is waiting for big data list to get populated. Would it be advantageous to wait on starting Backbone.history after certain regions get rendered?
Also, which is the right place to authenticate user ?
It is better to call Backbone.history.start()
in initialize:after
to be sure that all routers are created in initialization process.
If you create router after Backbone.history.start()
it will not trigger his routes.
Also you can read more about initialization process in article of Derick Bailey: http://lostechies.com/derickbailey/2012/02/06/3-stages-of-a-backbone-applications-startup/
Starting history and rendering some region should not related.
You can authenticate user in onStart
event of Marionette.Application
.