@@ -13,7 +13,7 @@ import {
13
13
*/
14
14
15
15
export function canReuse ( view , handler , transition ) {
16
- let component = view . childVM
16
+ const component = view . childVM
17
17
if ( ! component || ! handler ) {
18
18
return false
19
19
}
@@ -22,7 +22,7 @@ export function canReuse (view, handler, transition) {
22
22
if ( view . Component !== handler . component ) {
23
23
return false
24
24
}
25
- let canReuseFn = getRouteConfig ( component , 'canReuse' )
25
+ const canReuseFn = getRouteConfig ( component , 'canReuse' )
26
26
return typeof canReuseFn === 'boolean'
27
27
? canReuseFn
28
28
: canReuseFn
@@ -41,8 +41,8 @@ export function canReuse (view, handler, transition) {
41
41
*/
42
42
43
43
export function canDeactivate ( view , transition , next ) {
44
- let fromComponent = view . childVM
45
- let hook = getRouteConfig ( fromComponent , 'canDeactivate' )
44
+ const fromComponent = view . childVM
45
+ const hook = getRouteConfig ( fromComponent , 'canDeactivate' )
46
46
if ( ! hook ) {
47
47
next ( )
48
48
} else {
@@ -67,7 +67,7 @@ export function canActivate (handler, transition, next) {
67
67
return
68
68
}
69
69
// determine if this component can be activated
70
- let hook = getRouteConfig ( Component , 'canActivate' )
70
+ const hook = getRouteConfig ( Component , 'canActivate' )
71
71
if ( ! hook ) {
72
72
next ( )
73
73
} else {
@@ -87,8 +87,8 @@ export function canActivate (handler, transition, next) {
87
87
*/
88
88
89
89
export function deactivate ( view , transition , next ) {
90
- let component = view . childVM
91
- let hook = getRouteConfig ( component , 'deactivate' )
90
+ const component = view . childVM
91
+ const hook = getRouteConfig ( component , 'deactivate' )
92
92
if ( ! hook ) {
93
93
next ( )
94
94
} else {
@@ -106,7 +106,7 @@ export function deactivate (view, transition, next) {
106
106
*/
107
107
108
108
export function activate ( view , transition , depth , cb , reuse ) {
109
- let handler = transition . activateQueue [ depth ]
109
+ const handler = transition . activateQueue [ depth ]
110
110
if ( ! handler ) {
111
111
saveChildView ( view )
112
112
if ( view . _bound ) {
@@ -116,16 +116,16 @@ export function activate (view, transition, depth, cb, reuse) {
116
116
return
117
117
}
118
118
119
- let Component = view . Component = handler . component
120
- let activateHook = getRouteConfig ( Component , 'activate' )
121
- let dataHook = getRouteConfig ( Component , 'data' )
122
- let waitForData = getRouteConfig ( Component , 'waitForData' )
119
+ const Component = view . Component = handler . component
120
+ const activateHook = getRouteConfig ( Component , 'activate' )
121
+ const dataHook = getRouteConfig ( Component , 'data' )
122
+ const waitForData = getRouteConfig ( Component , 'waitForData' )
123
123
124
124
view . depth = depth
125
125
view . activated = false
126
126
127
127
let component
128
- let loading = ! ! ( dataHook && ! waitForData )
128
+ const loading = ! ! ( dataHook && ! waitForData )
129
129
130
130
// "reuse" is a flag passed down when the parent view is
131
131
// either reused via keep-alive or as a child of a kept-alive view.
@@ -162,7 +162,7 @@ export function activate (view, transition, depth, cb, reuse) {
162
162
// and also properly update current view's child view.
163
163
if ( view . keepAlive ) {
164
164
component . $loadingRouteData = loading
165
- let cachedChildView = component . _keepAliveRouterView
165
+ const cachedChildView = component . _keepAliveRouterView
166
166
if ( cachedChildView ) {
167
167
view . childView = cachedChildView
168
168
component . _keepAliveRouterView = null
@@ -172,17 +172,17 @@ export function activate (view, transition, depth, cb, reuse) {
172
172
173
173
// cleanup the component in case the transition is aborted
174
174
// before the component is ever inserted.
175
- let cleanup = ( ) => {
175
+ const cleanup = ( ) => {
176
176
component . $destroy ( )
177
177
}
178
178
179
179
// actually insert the component and trigger transition
180
- let insert = ( ) => {
180
+ const insert = ( ) => {
181
181
if ( reuse ) {
182
182
cb && cb ( )
183
183
return
184
184
}
185
- let router = transition . router
185
+ const router = transition . router
186
186
if ( router . _rendered || router . _transitionOnLoad ) {
187
187
view . transition ( component )
188
188
} else {
@@ -201,7 +201,7 @@ export function activate (view, transition, depth, cb, reuse) {
201
201
}
202
202
203
203
// called after activation hook is resolved
204
- let afterActivate = ( ) => {
204
+ const afterActivate = ( ) => {
205
205
view . activated = true
206
206
// activate the child view
207
207
if ( view . childView ) {
@@ -234,8 +234,8 @@ export function activate (view, transition, depth, cb, reuse) {
234
234
*/
235
235
236
236
export function reuse ( view , transition ) {
237
- let component = view . childVM
238
- let dataHook = getRouteConfig ( component , 'data' )
237
+ const component = view . childVM
238
+ const dataHook = getRouteConfig ( component , 'data' )
239
239
if ( dataHook ) {
240
240
loadData ( component , transition , dataHook )
241
241
}
@@ -266,10 +266,10 @@ function loadData (component, transition, hook, cb, cleanup) {
266
266
} , Object . create ( null ) )
267
267
}
268
268
// handle promise sugar syntax
269
- let promises = [ ]
269
+ const promises = [ ]
270
270
if ( isPlainObject ( data ) ) {
271
271
Object . keys ( data ) . forEach ( key => {
272
- let val = data [ key ]
272
+ const val = data [ key ]
273
273
if ( isPromise ( val ) ) {
274
274
promises . push ( val . then ( resolvedVal => {
275
275
component . $set ( key , resolvedVal )
@@ -312,7 +312,7 @@ function saveChildView (view) {
312
312
313
313
/**
314
314
* Check plain object.
315
- *
315
+ *
316
316
* @param {* } val
317
317
*/
318
318
0 commit comments