6
6
Provider ,
7
7
} from '@angular/core' ;
8
8
import {
9
+ Event as RouterEvent ,
9
10
NavigationCancel ,
10
11
NavigationEnd ,
11
12
NavigationError ,
@@ -75,9 +76,12 @@ export class RouterHistoryStore extends ComponentStore<RouterHistoryState> {
75
76
/**
76
77
* All router events.
77
78
*/
78
- #routerEvents = this . select ( this . #router. events , ( events ) => events ) ;
79
+ #routerEvents: Observable < RouterEvent > = this . select (
80
+ this . #router. events ,
81
+ ( events ) => events
82
+ ) ;
79
83
/**
80
- * All router events concluding a navigation .
84
+ * All router events concluding a router sequence .
81
85
*/
82
86
#navigationResult$: Observable <
83
87
NavigationEnd | NavigationCancel | NavigationError
@@ -108,15 +112,15 @@ export class RouterHistoryStore extends ComponentStore<RouterHistoryState> {
108
112
/**
109
113
* The most recent completed navigation.
110
114
*/
111
- #latestRouterNavigatedSequence$ = this . select (
112
- this . #maxNavigatedId$ ,
113
- this . #history $,
114
- ( maxNavigatedId , history ) =>
115
- history [ maxNavigatedId ] as RouterNavigatedSequence ,
116
- {
117
- debounce : true ,
118
- }
119
- ) ;
115
+ #latestRouterNavigatedSequence$: Observable < RouterNavigatedSequence > =
116
+ this . select (
117
+ this . #maxNavigatedId $,
118
+ this . #history$ ,
119
+ ( maxNavigatedId , history ) => history [ maxNavigatedId ] ,
120
+ {
121
+ debounce : true ,
122
+ }
123
+ ) ;
120
124
121
125
/**
122
126
* The current URL.
@@ -139,7 +143,7 @@ export class RouterHistoryStore extends ComponentStore<RouterHistoryState> {
139
143
return undefined ;
140
144
}
141
145
142
- const [ sourceNavigationStart ] = this . #getNavigationSource (
146
+ const [ sourceNavigationStart ] = this . #findNavigatedSource (
143
147
maxNavigatedId ,
144
148
history
145
149
) ;
@@ -149,7 +153,7 @@ export class RouterHistoryStore extends ComponentStore<RouterHistoryState> {
149
153
}
150
154
151
155
const previousNavigationId = sourceNavigationStart . id - 1 ;
152
- const [ , previousNavigationEnd ] = this . #getNavigationSource (
156
+ const [ , previousNavigationEnd ] = this . #findNavigatedSource (
153
157
previousNavigationId ,
154
158
history
155
159
) ;
@@ -189,16 +193,16 @@ export class RouterHistoryStore extends ComponentStore<RouterHistoryState> {
189
193
) ;
190
194
191
195
/**
192
- * Search the specified navigation history to find the source of the
193
- * specified navigation event .
196
+ * Search the specified history to find the source of the router navigated
197
+ * sequence .
194
198
*
195
199
* This takes `popstate` navigation events into account.
196
200
*
197
201
* @param navigationId The ID of the navigation to trace.
198
202
* @param history The navigation history to search.
199
- * @returns The source navigation .
203
+ * @returns The source router navigated sequence .
200
204
*/
201
- #getNavigationSource (
205
+ #findNavigatedSource (
202
206
navigationId : number ,
203
207
history : RouterNavigatedHistory
204
208
) : RouterNavigatedSequence {
0 commit comments