Add autoStartRouting property to Ember.Application #1222

Closed
wants to merge 2 commits into
from

5 participants

@joewest

If router exists, flags whether startRouting is called automatically on App.initialize(). Defaults to true.

This is particularly useful for cases where you want the app to initialize but not start url routing immediately (such as determining whether a user has a valid session).

@joewest joewest Add autoStartRouting flag to Ember.Application
If `router` exists, determines whether startRouting is called automatically on
App.initialize(). Defaults to true
7df6568
@travisbot

This pull request passes (merged 7df6568 into d7e24ac).

@dmathieu

It would be very nice if you could also write tests for this.

@travisbot

This pull request passes (merged ff9abab into d7e24ac).

@raycohen

location appears to only be used inside startRouting

@raycohen

@joewest I'm just starting to use the router... what's the main benefit of doing this over determining user session prior to calling App.initialize()?

For example I'm doing something like

App.User.setupCurrentUser().always(function() {
  App.initialize();
})
@joewest

@raycohen That works too, tho you have to manually manage any controllers used in the bootstrap process since they're created by App.initialize(). My thinking was that it let's you use the router/state-manager to manage the loading or authentication process. So you have states like:

App.Router = Ember.Router.extend({
  root: Ember.Route.extend({
    loading: Em.State.extend(),
    isLoaded: Em.Route.extend(),
    unLoaded: Em.State.extend()
  })
});

Then inside of isLoaded you run App.startRouting(router) during enter/setup/connectOutlets.

@wagenet
Ember.js member

We now have an autoinit property for the application. I think that serves the same general function. Let me know if I'm mistaken.

@wagenet wagenet closed this Oct 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment