interfaces.ts
116 lines
| 2.8 KiB
| video/mp2t
|
TypeScriptLexer
|
|
r75 | export interface Constructor<T = {}> { | ||
|
|
r81 | new(...args: any[]): T; | ||
|
|
r75 | prototype: T; | ||
| } | ||||
|
|
r49 | |||
| export type Factory<T = {}> = (...args: any[]) => T; | ||||
|
|
r59 | export type Predicate<T = any> = (x: T) => boolean; | ||
|
|
r55 | export interface MapOf<T> { | ||
| [key: string]: T; | ||||
| } | ||||
|
|
r49 | export interface IDestroyable { | ||
|
|
r75 | destroy(): void; | ||
| } | ||||
| export interface IRemovable { | ||||
| remove(): void; | ||||
|
|
r49 | } | ||
| export interface ICancellation { | ||||
| throwIfRequested(): void; | ||||
| isRequested(): boolean; | ||||
| isSupported(): boolean; | ||||
| register(cb: (e: any) => void): IDestroyable; | ||||
| } | ||||
| /** | ||||
| * Интерфейс поддерживающий асинхронную активацию | ||||
| */ | ||||
| export interface IActivatable { | ||||
| /** | ||||
| * @returns Boolean indicates the current state | ||||
| */ | ||||
| isActive(): boolean; | ||||
| /** | ||||
| * Starts the component activation | ||||
| * @param ct cancellation token for this operation | ||||
| */ | ||||
| activate(ct?: ICancellation): Promise<void>; | ||||
| /** | ||||
| * Starts the component deactivation | ||||
| * @param ct cancellation token for this operation | ||||
| */ | ||||
| deactivate(ct?: ICancellation): Promise<void>; | ||||
| /** | ||||
| * Sets the activation controller for this component | ||||
| * @param controller The activation controller | ||||
| * | ||||
| * Activation controller checks whether this component | ||||
| * can be activated and manages the active state of the | ||||
| * component | ||||
| */ | ||||
|
|
r111 | setActivationController(controller: IActivationController): void; | ||
|
|
r49 | |||
|
|
r115 | /** Indicates whether this component has an activation controller */ | ||
| hasActivationController(): boolean; | ||||
|
|
r49 | /** | ||
| * Gets the current activation controller for this component | ||||
| */ | ||||
| getActivationController(): IActivationController; | ||||
| } | ||||
| export interface IActivationController { | ||||
| activating(component: IActivatable, ct?: ICancellation): Promise<void>; | ||||
| activated(component: IActivatable, ct?: ICancellation): Promise<void>; | ||||
| deactivating(component: IActivatable, ct?: ICancellation): Promise<void>; | ||||
| deactivated(component: IActivatable, ct?: ICancellation): Promise<void>; | ||||
| deactivate(ct?: ICancellation): Promise<void>; | ||||
| activate(component: IActivatable, ct?: ICancellation): Promise<void>; | ||||
|
|
r115 | hasActive(): boolean; | ||
|
|
r49 | getActive(): IActivatable; | ||
| } | ||||
| export interface IAsyncComponent { | ||||
| getCompletion(): Promise<void>; | ||||
| } | ||||
| export interface ICancellable { | ||||
| cancel(reason?: any): void; | ||||
| } | ||||
| export interface IObservable<T> { | ||||
| on(next: (x: T) => void, error?: (e: any) => void, complete?: () => void): IDestroyable; | ||||
| next(ct?: ICancellation): Promise<T>; | ||||
| } | ||||
|
|
r76 | |||
| export interface IObserver<T> { | ||||
| next(event: T): void; | ||||
| error(e: any): void; | ||||
| complete(): void; | ||||
| } | ||||
|
|
r78 | |||
| export interface TextWriter { | ||||
|
|
r82 | write(obj: any): void; | ||
| write(format: string, ...args: any[]): void; | ||||
|
|
r81 | |||
|
|
r82 | writeLine(obj?: any): void; | ||
| writeLine(format: string, ...args: any[]): void; | ||||
|
|
r81 | |||
|
|
r82 | writeValue(value: any, spec?: string): void; | ||
|
|
r78 | } | ||
