1
1
/**
2
2
* @coreapi
3
3
* @module transition
4
- */ /** for typedoc */
4
+ */
5
+ /** for typedoc */
5
6
import {
6
- IHookRegistry , TransitionOptions , TransitionHookScope , TransitionHookPhase , TransitionCreateHookFn ,
7
- HookMatchCriteria , HookRegOptions , PathTypes , PathType , RegisteredHooks , IHookRegistration , TransitionHookFn ,
8
- TransitionStateHookFn
7
+ IHookRegistry , TransitionOptions , TransitionHookScope , TransitionHookPhase , TransitionCreateHookFn , HookMatchCriteria ,
8
+ HookRegOptions , PathTypes , PathType , RegisteredHooks , TransitionHookFn , TransitionStateHookFn
9
9
} from "./interface" ;
10
10
import { Transition } from "./transition" ;
11
11
import { makeEvent , RegisteredHook } from "./hookRegistry" ;
12
12
import { TargetState } from "../state/targetState" ;
13
13
import { PathNode } from "../path/node" ;
14
14
import { ViewService } from "../view/view" ;
15
15
import { UIRouter } from "../router" ;
16
+ import { registerAddCoreResolvables } from "../hooks/coreResolvables" ;
17
+ import { registerRedirectToHook } from "../hooks/redirectTo" ;
18
+ import { registerOnExitHook , registerOnRetainHook , registerOnEnterHook } from "../hooks/onEnterExitRetain" ;
16
19
import { registerEagerResolvePath , registerLazyResolveState } from "../hooks/resolve" ;
17
20
import { registerLoadEnteringViews , registerActivateViews } from "../hooks/views" ;
21
+ import { registerUpdateGlobalState } from "../hooks/updateGlobals" ;
18
22
import { registerUpdateUrl } from "../hooks/url" ;
19
- import { registerRedirectToHook } from "../hooks/redirectTo" ;
20
- import { registerOnExitHook , registerOnRetainHook , registerOnEnterHook } from "../hooks/onEnterExitRetain" ;
21
23
import { registerLazyLoadHook } from "../hooks/lazyLoad" ;
22
24
import { TransitionEventType } from "./transitionEventType" ;
23
25
import { TransitionHook , GetResultHandler , GetErrorHandler } from "./transitionHook" ;
@@ -167,6 +169,7 @@ export class TransitionService implements IHookRegistry, Disposable {
167
169
* @hidden
168
170
*/
169
171
_deregisterHookFns : {
172
+ addCoreResolves : Function ;
170
173
redirectTo : Function ;
171
174
onExit : Function ;
172
175
onRetain : Function ;
@@ -175,6 +178,7 @@ export class TransitionService implements IHookRegistry, Disposable {
175
178
lazyResolve : Function ;
176
179
loadViews : Function ;
177
180
activateViews : Function ;
181
+ updateGlobals : Function ;
178
182
updateUrl : Function ;
179
183
lazyLoad : Function ;
180
184
} ;
@@ -195,7 +199,7 @@ export class TransitionService implements IHookRegistry, Disposable {
195
199
this . _defineDefaultPaths ( ) ;
196
200
this . _defineDefaultEvents ( ) ;
197
201
198
- this . _registerDefaultTransitionHooks ( ) ;
202
+ this . _registerCoreTransitionHooks ( ) ;
199
203
}
200
204
201
205
/**
@@ -312,29 +316,34 @@ export class TransitionService implements IHookRegistry, Disposable {
312
316
}
313
317
314
318
/** @hidden */
315
- private _registerDefaultTransitionHooks ( ) {
319
+ private _registerCoreTransitionHooks ( ) {
316
320
let fns = this . _deregisterHookFns ;
317
321
322
+ fns . addCoreResolves = registerAddCoreResolvables ( this ) ;
323
+
318
324
// Wire up redirectTo hook
319
- fns . redirectTo = registerRedirectToHook ( this ) ;
325
+ fns . redirectTo = registerRedirectToHook ( this ) ;
320
326
321
327
// Wire up onExit/Retain/Enter state hooks
322
- fns . onExit = registerOnExitHook ( this ) ;
323
- fns . onRetain = registerOnRetainHook ( this ) ;
324
- fns . onEnter = registerOnEnterHook ( this ) ;
328
+ fns . onExit = registerOnExitHook ( this ) ;
329
+ fns . onRetain = registerOnRetainHook ( this ) ;
330
+ fns . onEnter = registerOnEnterHook ( this ) ;
325
331
326
332
// Wire up Resolve hooks
327
- fns . eagerResolve = registerEagerResolvePath ( this ) ;
328
- fns . lazyResolve = registerLazyResolveState ( this ) ;
329
-
333
+ fns . eagerResolve = registerEagerResolvePath ( this ) ;
334
+ fns . lazyResolve = registerLazyResolveState ( this ) ;
335
+
330
336
// Wire up the View management hooks
331
- fns . loadViews = registerLoadEnteringViews ( this ) ;
332
- fns . activateViews = registerActivateViews ( this ) ;
337
+ fns . loadViews = registerLoadEnteringViews ( this ) ;
338
+ fns . activateViews = registerActivateViews ( this ) ;
339
+
340
+ // Updates global state after a transition
341
+ fns . updateGlobals = registerUpdateGlobalState ( this ) ;
333
342
334
343
// After globals.current is updated at priority: 10000
335
- fns . updateUrl = registerUpdateUrl ( this ) ;
344
+ fns . updateUrl = registerUpdateUrl ( this ) ;
336
345
337
346
// Lazy load state trees
338
- fns . lazyLoad = registerLazyLoadHook ( this ) ;
347
+ fns . lazyLoad = registerLazyLoadHook ( this ) ;
339
348
}
340
349
}
0 commit comments