@@ -2,6 +2,7 @@ var React = require('react');
22var invariant = require ( 'react/lib/invariant' ) ;
33var PathState = require ( './PathState' ) ;
44var RouteContainer = require ( './RouteContainer' ) ;
5+ var LocationActions = require ( '../actions/LocationActions' ) ;
56var HashLocation = require ( '../locations/HashLocation' ) ;
67var Path = require ( '../utils/Path' ) ;
78
@@ -62,52 +63,48 @@ var PathDelegate = {
6263 * Transitions to the URL specified in the arguments by pushing
6364 * a new URL onto the history stack.
6465 */
65- transitionTo : function ( to , params , query , sender ) {
66- sender = sender || this ;
67-
66+ transitionTo : function ( to , params , query ) {
6867 var path = this . makePath ( to , params , query ) ;
6968 var location = this . getLocation ( ) ;
7069
71- // If we have a location, route the transition through it.
70+ // If we have a location, route the transition
71+ // through it so the URL is updated as well.
7272 if ( location ) {
73- location . push ( path , this ) ;
73+ location . push ( path ) ;
7474 } else if ( this . updatePath ) {
75- this . updatePath ( path , this ) ;
75+ this . updatePath ( path , LocationActions . PUSH ) ;
7676 }
7777 } ,
7878
7979 /**
8080 * Transitions to the URL specified in the arguments by replacing
8181 * the current URL in the history stack.
8282 */
83- replaceWith : function ( to , params , query , sender ) {
84- sender = sender || this ;
85-
83+ replaceWith : function ( to , params , query ) {
8684 var path = this . makePath ( to , params , query ) ;
8785 var location = this . getLocation ( ) ;
8886
89- // If we have a location, route the transition through it.
87+ // If we have a location, route the transition
88+ // through it so the URL is updated as well.
9089 if ( location ) {
91- location . replace ( path , sender ) ;
90+ location . replace ( path ) ;
9291 } else if ( this . updatePath ) {
93- this . updatePath ( path , sender ) ;
92+ this . updatePath ( path , LocationActions . REPLACE ) ;
9493 }
9594 } ,
9695
9796 /**
9897 * Transitions to the previous URL.
9998 */
100- goBack : function ( sender ) {
101- sender = sender || this ;
102-
99+ goBack : function ( ) {
103100 var location = this . getLocation ( ) ;
104101
105102 invariant (
106103 location ,
107104 'You cannot goBack without a location'
108105 ) ;
109106
110- location . pop ( sender ) ;
107+ location . pop ( ) ;
111108 }
112109
113110} ;
0 commit comments