1 | import { TransitionHookOptions, HookResult } from './interface';
|
2 | import { Transition } from './transition';
|
3 | import { TransitionEventType } from './transitionEventType';
|
4 | import { RegisteredHook } from './hookRegistry';
|
5 | import { StateDeclaration } from '../state/interface';
|
6 | export type GetResultHandler = (hook: TransitionHook) => ResultHandler;
|
7 | export type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;
|
8 | export type ResultHandler = (result: HookResult) => Promise<HookResult>;
|
9 | export type ErrorHandler = (error: any) => Promise<any>;
|
10 | export declare class TransitionHook {
|
11 | private transition;
|
12 | private stateContext;
|
13 | private registeredHook;
|
14 | private options;
|
15 | type: TransitionEventType;
|
16 | |
17 |
|
18 |
|
19 |
|
20 | static HANDLE_RESULT: GetResultHandler;
|
21 | |
22 |
|
23 |
|
24 |
|
25 | static LOG_REJECTED_RESULT: GetResultHandler;
|
26 | |
27 |
|
28 |
|
29 |
|
30 | static LOG_ERROR: GetErrorHandler;
|
31 | static REJECT_ERROR: GetErrorHandler;
|
32 | static THROW_ERROR: GetErrorHandler;
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | static chain(hooks: TransitionHook[], waitFor?: Promise<any>): Promise<any>;
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | static invokeHooks<T>(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise<any> | T;
|
64 | /**
|
65 | * Run all TransitionHooks, ignoring their return value.
|
66 | */
|
67 | static runAllHooks(hooks: TransitionHook[]): void;
|
68 | constructor(transition: Transition, stateContext: StateDeclaration, registeredHook: RegisteredHook, options: TransitionHookOptions);
|
69 | private isSuperseded;
|
70 | logError(err: any): any;
|
71 | invokeHook(): Promise<HookResult> | void;
|
72 | /**
|
73 | * This method handles the return value of a Transition Hook.
|
74 | *
|
75 | * A hook can return false (cancel), a TargetState (redirect),
|
76 | * or a promise (which may later resolve to false or a redirect)
|
77 | *
|
78 | * This also handles "transition superseded" -- when a new transition
|
79 | * was started while the hook was still running
|
80 | */
|
81 | handleHookResult(result: HookResult): Promise<HookResult>;
|
82 | /**
|
83 | * Return a Rejection promise if the transition is no longer current due
|
84 | * to a stopped router (disposed), or a new transition has started and superseded this one.
|
85 | */
|
86 | private getNotCurrentRejection;
|
87 | toString(): string;
|
88 | }
|
89 |
|
\ | No newline at end of file |