Skip to content

Commit

Permalink
[fixed] allow a StaticLocation to be passed directly when creating a …
Browse files Browse the repository at this point in the history
…router
  • Loading branch information
insin committed Feb 14, 2015
1 parent 7d52d55 commit f975bdf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/createRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ function createRouter(options) {
var pendingTransition = null;
var dispatchHandler = null;

if (typeof location === 'string') {
if (typeof location === 'string')
location = new StaticLocation(location);

if (location instanceof StaticLocation) {
warning(
!canUseDOM || process.env.NODE_ENV === 'test',
'You should not use a static location in a DOM environment because ' +
'the router will not be kept in sync with the current URL'
);

location = new StaticLocation(location);
} else {
invariant(
canUseDOM || location.needsDOM === false,
Expand Down

0 comments on commit f975bdf

Please sign in to comment.