File tree 3 files changed +11
-20
lines changed
3 files changed +11
-20
lines changed Original file line number Diff line number Diff line change 49
49
"eslint-plugin-html" : " ^1.5.2" ,
50
50
"express" : " ^4.14.0" ,
51
51
"express-urlrewrite" : " ^1.2.0" ,
52
- "flow-bin" : " ^0.32 .0" ,
52
+ "flow-bin" : " ^0.33 .0" ,
53
53
"gitbook-plugin-edit-link" : " ^2.0.2" ,
54
54
"gitbook-plugin-github" : " ^2.0.0" ,
55
55
"jasmine" : " 2.4.1" ,
Original file line number Diff line number Diff line change @@ -108,14 +108,6 @@ export class History {
108
108
hook && hook ( route , prev )
109
109
} )
110
110
}
111
-
112
- /**
113
- * Dummy method to make flow happy...
114
- * otherwise it won't let me call `this.history.onHashChange`
115
- * inside a `switch case`...
116
- * Advices on how to remove this method are much appreciated.
117
- */
118
- onHashChange ( ) { }
119
111
}
120
112
121
113
function normalizeBase ( base : ?string ) : string {
Original file line number Diff line number Diff line change @@ -65,20 +65,19 @@ export default class VueRouter {
65
65
66
66
this . app = app
67
67
68
- switch ( this . mode ) {
69
- case 'history' :
70
- this . history . transitionTo ( getLocation ( this . history . base ) )
71
- break
72
- case 'hash' :
73
- this . history . transitionTo ( getHash ( ) , ( ) => {
74
- window . addEventListener ( 'hashchange' , ( ) => {
75
- this . history . onHashChange ( )
76
- } )
68
+ const history = this . history
69
+
70
+ if ( history instanceof HTML5History ) {
71
+ history . transitionTo ( getLocation ( history . base ) )
72
+ } else if ( history instanceof HashHistory ) {
73
+ history . transitionTo ( getHash ( ) , ( ) => {
74
+ window . addEventListener ( 'hashchange' , ( ) => {
75
+ history . onHashChange ( )
77
76
} )
78
- break
77
+ } )
79
78
}
80
79
81
- this . history . listen ( route => {
80
+ history . listen ( route => {
82
81
this . app . _route = route
83
82
} )
84
83
}
You can’t perform that action at this time.
0 commit comments