@@ -2,6 +2,7 @@ var React = require('react');
2
2
var invariant = require ( 'react/lib/invariant' ) ;
3
3
var PathState = require ( './PathState' ) ;
4
4
var RouteContainer = require ( './RouteContainer' ) ;
5
+ var LocationActions = require ( '../actions/LocationActions' ) ;
5
6
var HashLocation = require ( '../locations/HashLocation' ) ;
6
7
var Path = require ( '../utils/Path' ) ;
7
8
@@ -62,52 +63,48 @@ var PathDelegate = {
62
63
* Transitions to the URL specified in the arguments by pushing
63
64
* a new URL onto the history stack.
64
65
*/
65
- transitionTo : function ( to , params , query , sender ) {
66
- sender = sender || this ;
67
-
66
+ transitionTo : function ( to , params , query ) {
68
67
var path = this . makePath ( to , params , query ) ;
69
68
var location = this . getLocation ( ) ;
70
69
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.
72
72
if ( location ) {
73
- location . push ( path , this ) ;
73
+ location . push ( path ) ;
74
74
} else if ( this . updatePath ) {
75
- this . updatePath ( path , this ) ;
75
+ this . updatePath ( path , LocationActions . PUSH ) ;
76
76
}
77
77
} ,
78
78
79
79
/**
80
80
* Transitions to the URL specified in the arguments by replacing
81
81
* the current URL in the history stack.
82
82
*/
83
- replaceWith : function ( to , params , query , sender ) {
84
- sender = sender || this ;
85
-
83
+ replaceWith : function ( to , params , query ) {
86
84
var path = this . makePath ( to , params , query ) ;
87
85
var location = this . getLocation ( ) ;
88
86
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.
90
89
if ( location ) {
91
- location . replace ( path , sender ) ;
90
+ location . replace ( path ) ;
92
91
} else if ( this . updatePath ) {
93
- this . updatePath ( path , sender ) ;
92
+ this . updatePath ( path , LocationActions . REPLACE ) ;
94
93
}
95
94
} ,
96
95
97
96
/**
98
97
* Transitions to the previous URL.
99
98
*/
100
- goBack : function ( sender ) {
101
- sender = sender || this ;
102
-
99
+ goBack : function ( ) {
103
100
var location = this . getLocation ( ) ;
104
101
105
102
invariant (
106
103
location ,
107
104
'You cannot goBack without a location'
108
105
) ;
109
106
110
- location . pop ( sender ) ;
107
+ location . pop ( ) ;
111
108
}
112
109
113
110
} ;
0 commit comments