Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] Lazily reify router’s location #10483

Merged
merged 3 commits into from
Mar 5, 2015
Merged

[REFACTOR] Lazily reify router’s location #10483

merged 3 commits into from
Mar 5, 2015

Commits on Mar 3, 2015

  1. Lazily reify router’s location

    Users can override a router’s location by specifying its `location`
    property as a string. For example, to change the router from the “auto”
    location to the “none” location, users can do the following:
    
    ```js
    // app/router.js
    export default Ember.Router.extend({
     location: 'none'
    });
    ```
    
    Previously, the reification of the string value into a concrete Location
    implementation happened at router creation time.
    
    This immediate reification made it difficult to make changes to the
    router configuration, since it had to be done at creation time. In
    general, classes that require configuration to be set at creation time
    are unwieldy to use with the container, since the container itself
    manages creation.
    
    For example, in the case of the Application's `visit()` API, the
    application instance would like to override the router to use the
    `none` location.
    
    When reification was at creation time, the router was created with the
    wrong location. Before the default could be overridden, the router would
    try to set up things like listeners on the browser's address bar, which
    would cause an exception to be thrown in Node environments where there
    is no notion of a URL.
    
    In this commit, reifying and setting up the location are deferred until
    the last possible moment, when routing starts (either by calling
    `startRouting()`, which starts the app at the browser's current URL, or
    by calling `handleURL()`, which starts the app at a provided URL). This
    allows the application to detect if it is in autoboot mode or not, and
    override the router's location before routing begins.
    tilde-engineering authored and tomdale committed Mar 3, 2015
    Configuration menu
    Copy the full SHA
    8e130e5 View commit details
    Browse the repository at this point in the history
  2. Make router CP read-only

    tilde-engineering authored and tomdale committed Mar 3, 2015
    Configuration menu
    Copy the full SHA
    91cda57 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bf3d5eb View commit details
    Browse the repository at this point in the history