feat(router): add events tracking activation of individual routes
* Adds `ChildActivationStart` and `ChildActivationEnd` * Adds test to verify the PreActivation phase of routing
This commit is contained in:

committed by
Alex Rickabaugh

parent
82b067fc40
commit
49cd8513e4
66
tools/public_api_guard/router/router.d.ts
vendored
66
tools/public_api_guard/router/router.d.ts
vendored
@ -59,6 +59,16 @@ export interface CanLoad {
|
||||
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class ChildActivationEnd extends RouteEvent {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class ChildActivationStart extends RouteEvent {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class ChildrenOutletContexts {
|
||||
getContext(childName: string): OutletContext | null;
|
||||
@ -87,7 +97,7 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
|
||||
export declare type DetachedRouteHandle = {};
|
||||
|
||||
/** @stable */
|
||||
export declare type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError | RoutesRecognized | RouteConfigLoadStart | RouteConfigLoadEnd | GuardsCheckStart | GuardsCheckEnd | ResolveStart | ResolveEnd;
|
||||
export declare type Event = RouterEvent | RouteEvent;
|
||||
|
||||
/** @stable */
|
||||
export interface ExtraOptions {
|
||||
@ -99,11 +109,9 @@ export interface ExtraOptions {
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class GuardsCheckEnd {
|
||||
id: number;
|
||||
export declare class GuardsCheckEnd extends RouterEvent {
|
||||
shouldActivate: boolean;
|
||||
state: RouterStateSnapshot;
|
||||
url: string;
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
@ -115,10 +123,8 @@ export declare class GuardsCheckEnd {
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class GuardsCheckStart {
|
||||
id: number;
|
||||
export declare class GuardsCheckStart extends RouterEvent {
|
||||
state: RouterStateSnapshot;
|
||||
url: string;
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
@ -135,10 +141,8 @@ export declare type LoadChildren = string | LoadChildrenCallback;
|
||||
export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Promise<Type<any>> | Observable<Type<any>>;
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationCancel {
|
||||
id: number;
|
||||
export declare class NavigationCancel extends RouterEvent {
|
||||
reason: string;
|
||||
url: string;
|
||||
constructor(
|
||||
id: number,
|
||||
url: string,
|
||||
@ -147,9 +151,7 @@ export declare class NavigationCancel {
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationEnd {
|
||||
id: number;
|
||||
url: string;
|
||||
export declare class NavigationEnd extends RouterEvent {
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
@ -159,10 +161,8 @@ export declare class NavigationEnd {
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationError {
|
||||
export declare class NavigationError extends RouterEvent {
|
||||
error: any;
|
||||
id: number;
|
||||
url: string;
|
||||
constructor(
|
||||
id: number,
|
||||
url: string,
|
||||
@ -183,12 +183,7 @@ export interface NavigationExtras {
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationStart {
|
||||
id: number;
|
||||
url: string;
|
||||
constructor(
|
||||
id: number,
|
||||
url: string);
|
||||
export declare class NavigationStart extends RouterEvent {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
@ -246,10 +241,8 @@ export declare type ResolveData = {
|
||||
};
|
||||
|
||||
/** @experimental */
|
||||
export declare class ResolveEnd {
|
||||
id: number;
|
||||
export declare class ResolveEnd extends RouterEvent {
|
||||
state: RouterStateSnapshot;
|
||||
url: string;
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
@ -260,10 +253,8 @@ export declare class ResolveEnd {
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class ResolveStart {
|
||||
id: number;
|
||||
export declare class ResolveStart extends RouterEvent {
|
||||
state: RouterStateSnapshot;
|
||||
url: string;
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
@ -293,19 +284,22 @@ export interface Route {
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class RouteConfigLoadEnd {
|
||||
route: Route;
|
||||
constructor(route: Route);
|
||||
export declare class RouteConfigLoadEnd extends RouteEvent {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class RouteConfigLoadStart {
|
||||
route: Route;
|
||||
constructor(route: Route);
|
||||
export declare class RouteConfigLoadStart extends RouteEvent {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class RouteEvent {
|
||||
route: Route;
|
||||
constructor(
|
||||
route: Route);
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class Router {
|
||||
config: Routes;
|
||||
@ -453,10 +447,8 @@ export declare type Routes = Route[];
|
||||
export declare const ROUTES: InjectionToken<Route[][]>;
|
||||
|
||||
/** @stable */
|
||||
export declare class RoutesRecognized {
|
||||
id: number;
|
||||
export declare class RoutesRecognized extends RouterEvent {
|
||||
state: RouterStateSnapshot;
|
||||
url: string;
|
||||
urlAfterRedirects: string;
|
||||
constructor(
|
||||
id: number,
|
||||
|
Reference in New Issue
Block a user