This repository was archived by the owner on Jun 1, 2019. It is now read-only.
File tree 3 files changed +13
-9
lines changed 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,6 @@ var RouterMixin = {
137
137
* @param {Callback } cb
138
138
*/
139
139
navigate : function ( path , navigation , cb ) {
140
- if ( typeof navigation === 'function' && cb === undefined ) {
141
- cb = navigation ;
142
- navigation = { } ;
143
- }
144
- navigation = navigation || { } ;
145
140
path = join ( this . state . prefix , path ) ;
146
141
this . getEnvironment ( ) . setPath ( path , navigation , cb ) ;
147
142
} ,
Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ DummyEnvironment.prototype.constructor = DummyEnvironment;
17
17
18
18
DummyEnvironment . prototype . getPath = emptyFunction . thatReturnsNull ;
19
19
20
- DummyEnvironment . prototype . setPath = function ( path , cb ) {
20
+ DummyEnvironment . prototype . setPath = function ( path , navigation , cb ) {
21
+ // Support old (path, cb) arity
22
+ if ( typeof navigation === 'function' && cb === undefined ) {
23
+ cb = navigation ;
24
+ navigation = { } ;
25
+ }
21
26
this . path = path ;
22
27
cb ( ) ;
23
28
} ;
Original file line number Diff line number Diff line change @@ -44,14 +44,18 @@ Environment.prototype.makeHref = function makeHref(path) {
44
44
}
45
45
46
46
Environment . prototype . navigate = function navigate ( path , navigation , cb ) {
47
+ return this . setPath ( path , navigation , cb ) ;
48
+ }
49
+
50
+ Environment . prototype . setPath = function ( path , navigation , cb ) {
51
+ // Support (path, cb) arity.
47
52
if ( typeof navigation === 'function' && cb === undefined ) {
48
53
cb = navigation ;
49
54
navigation = { } ;
50
55
}
51
- return this . setPath ( path , navigation , cb ) ;
52
- }
56
+ // Support (path) arity.
57
+ if ( ! navigation ) navigation = { } ;
53
58
54
- Environment . prototype . setPath = function ( path , navigation , cb ) {
55
59
if ( ! navigation . isPopState ) {
56
60
if ( navigation . replace ) {
57
61
this . replaceState ( path , navigation ) ;
You can’t perform that action at this time.
0 commit comments