| @@ -1,101 +1,106 | |||
|
|
1 | 1 | export interface Constructor<T = {}> { |
|
|
2 | 2 | new (...args: any[]): T; |
|
|
3 | 3 | prototype: T; |
|
|
4 | 4 | } |
|
|
5 | 5 | |
|
|
6 | 6 | export type Factory<T = {}> = (...args: any[]) => T; |
|
|
7 | 7 | |
|
|
8 | 8 | export type Predicate<T = any> = (x: T) => boolean; |
|
|
9 | 9 | |
|
|
10 | 10 | export interface MapOf<T> { |
|
|
11 | 11 | [key: string]: T; |
|
|
12 | 12 | } |
|
|
13 | 13 | |
|
|
14 | 14 | export interface IDestroyable { |
|
|
15 | 15 | destroy(): void; |
|
|
16 | 16 | } |
|
|
17 | 17 | |
|
|
18 | 18 | export interface IRemovable { |
|
|
19 | 19 | remove(): void; |
|
|
20 | 20 | } |
|
|
21 | 21 | |
|
|
22 | 22 | export interface ICancellation { |
|
|
23 | 23 | throwIfRequested(): void; |
|
|
24 | 24 | isRequested(): boolean; |
|
|
25 | 25 | isSupported(): boolean; |
|
|
26 | 26 | register(cb: (e: any) => void): IDestroyable; |
|
|
27 | 27 | } |
|
|
28 | 28 | |
|
|
29 | 29 | /** |
|
|
30 | 30 | * ΠΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡΠΈΠΉ Π°ΡΠΈΠ½Ρ ΡΠΎΠ½Π½ΡΡ Π°ΠΊΡΠΈΠ²Π°ΡΠΈΡ |
|
|
31 | 31 | */ |
|
|
32 | 32 | export interface IActivatable { |
|
|
33 | 33 | /** |
|
|
34 | 34 | * @returns Boolean indicates the current state |
|
|
35 | 35 | */ |
|
|
36 | 36 | isActive(): boolean; |
|
|
37 | 37 | |
|
|
38 | 38 | /** |
|
|
39 | 39 | * Starts the component activation |
|
|
40 | 40 | * @param ct cancellation token for this operation |
|
|
41 | 41 | */ |
|
|
42 | 42 | activate(ct?: ICancellation): Promise<void>; |
|
|
43 | 43 | |
|
|
44 | 44 | /** |
|
|
45 | 45 | * Starts the component deactivation |
|
|
46 | 46 | * @param ct cancellation token for this operation |
|
|
47 | 47 | */ |
|
|
48 | 48 | deactivate(ct?: ICancellation): Promise<void>; |
|
|
49 | 49 | |
|
|
50 | 50 | /** |
|
|
51 | 51 | * Sets the activation controller for this component |
|
|
52 | 52 | * @param controller The activation controller |
|
|
53 | 53 | * |
|
|
54 | 54 | * Activation controller checks whether this component |
|
|
55 | 55 | * can be activated and manages the active state of the |
|
|
56 | 56 | * component |
|
|
57 | 57 | */ |
|
|
58 | 58 | setActivationController(controller: IActivationController); |
|
|
59 | 59 | |
|
|
60 | 60 | /** |
|
|
61 | 61 | * Gets the current activation controller for this component |
|
|
62 | 62 | */ |
|
|
63 | 63 | getActivationController(): IActivationController; |
|
|
64 | 64 | } |
|
|
65 | 65 | |
|
|
66 | 66 | export interface IActivationController { |
|
|
67 | 67 | activating(component: IActivatable, ct?: ICancellation): Promise<void>; |
|
|
68 | 68 | |
|
|
69 | 69 | activated(component: IActivatable, ct?: ICancellation): Promise<void>; |
|
|
70 | 70 | |
|
|
71 | 71 | deactivating(component: IActivatable, ct?: ICancellation): Promise<void>; |
|
|
72 | 72 | |
|
|
73 | 73 | deactivated(component: IActivatable, ct?: ICancellation): Promise<void>; |
|
|
74 | 74 | |
|
|
75 | 75 | deactivate(ct?: ICancellation): Promise<void>; |
|
|
76 | 76 | |
|
|
77 | 77 | activate(component: IActivatable, ct?: ICancellation): Promise<void>; |
|
|
78 | 78 | |
|
|
79 | 79 | getActive(): IActivatable; |
|
|
80 | 80 | } |
|
|
81 | 81 | |
|
|
82 | 82 | export interface IAsyncComponent { |
|
|
83 | 83 | getCompletion(): Promise<void>; |
|
|
84 | 84 | } |
|
|
85 | 85 | |
|
|
86 | 86 | export interface ICancellable { |
|
|
87 | 87 | cancel(reason?: any): void; |
|
|
88 | 88 | } |
|
|
89 | 89 | |
|
|
90 | 90 | export interface IObservable<T> { |
|
|
91 | 91 | on(next: (x: T) => void, error?: (e: any) => void, complete?: () => void): IDestroyable; |
|
|
92 | 92 | next(ct?: ICancellation): Promise<T>; |
|
|
93 | 93 | } |
|
|
94 | 94 | |
|
|
95 | 95 | export interface IObserver<T> { |
|
|
96 | 96 | next(event: T): void; |
|
|
97 | 97 | |
|
|
98 | 98 | error(e: any): void; |
|
|
99 | 99 | |
|
|
100 | 100 | complete(): void; |
|
|
101 | 101 | } |
|
|
102 | ||
|
|
103 | export interface TextWriter { | |
|
|
104 | formatter; | |
|
|
105 | Write(data, format?: string); | |
|
|
106 | } | |
General Comments 0
You need to be logged in to leave comments.
Login now
