forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
2638767
commit 8e130e5
Showing
5 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters