import { watchFile } from "fs"; export interface IDestroyable { destroy(); } export interface ICancellation { throwIfRequested(): void; isRequested(): boolean; isSupported(): boolean; register(cb: (e: any) => void): void; } /** * Интерфейс поддерживающий асинхронную активацию */ 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; /** * Starts the component deactivation * @param ct cancellation token for this operation */ deactivate(ct?: ICancellation) : Promise; /** * 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 */ setActivationController(controller: IActivationController); /** * Gets the current activation controller for this component */ getActivationController(): IActivationController; } export interface IActivationController { activating(component: IActivatable, ct?: ICancellation): Promise; activated(component: IActivatable, ct?: ICancellation): Promise; deactivating(component: IActivatable, ct?: ICancellation): Promise; deactivated(component: IActivatable, ct?: ICancellation): Promise; deactivate(ct?: ICancellation): Promise; activate(component: IActivatable, ct?: ICancellation): Promise; getActive(): IActivatable; } export interface IAsyncComponent { getCompletion(): Promise; } export interface ICancellable { cancel(reason?: any): void; } export interface IObserver { (x:T): void; } export interface IObservable { on(observer: IObserver): IDestroyable; wait(ct?: ICancellation) : Promise; }