@@ -14,13 +14,19 @@ export class History {
1414 afterHooks: Array < ?Function > ;
1515 cb: Function ;
1616
17+ // implemented by sub-classes
18+ go: Function ;
19+ push: Function ;
20+ replace: Function ;
21+
1722 constructor ( router : VueRouter , base : ?string ) {
1823 this . router = router
1924 this . base = normalizeBae ( base )
20- this . current = router . match ( this . getLocation ( ) )
25+ this . current = router . match ( '/' )
2126 this . pending = null
2227 this . beforeHooks = [ ]
2328 this . afterHooks = [ ]
29+ this . transitionTo ( this . getLocation ( ) )
2430 }
2531
2632 listen ( cb : Function ) {
@@ -35,23 +41,15 @@ export class History {
3541 this . afterHooks . push ( fn )
3642 }
3743
38- push ( location : RawLocation , cb ? : Function ) {
39- this . transitionTo ( location , cb )
40- }
41-
42- replace ( location : RawLocation , cb ? : Function ) {
43- this . transitionTo ( location , cb , true )
44- }
45-
46- transitionTo ( location : RawLocation , cb ? : Function , replace ? : boolean ) {
44+ transitionTo ( location : RawLocation , cb ? : Function ) {
4745 const route = this . router . match ( location , this . current )
4846 this . confirmTransition ( route , ( ) => {
4947 this . updateRoute ( route )
5048 cb && cb ( route )
51- } , replace )
49+ } )
5250 }
5351
54- confirmTransition ( route : Route , cb : Function , replace ? : boolean ) {
52+ confirmTransition ( route : Route , cb : Function ) {
5553 if ( isSameRoute ( route , this . current ) ) {
5654 return
5755 }
@@ -71,9 +69,7 @@ export class History {
7169 ) . filter ( _ => _ )
7270
7371 this . pending = route
74- const redirect = replace
75- ? location => this . replace ( location )
76- : location => this . push ( location )
72+ const redirect = location => this . push ( location )
7773
7874 runQueue (
7975 queue ,
0 commit comments