import { Event } from '@vscode-alt/monaco-editor/esm/vs/base/common/event'; /** * An event that is send out when the window is about to close. Clients have a chance to veto * the closing by either calling veto with a boolean "true" directly or with a promise that * resolves to a boolean. Returning a promise is useful in cases of long running operations * on shutdown. * * Note: It is absolutely important to avoid long running promises if possible. Please try hard * to return a boolean directly. Returning a promise has quite an impact on the shutdown sequence! */ export interface BeforeShutdownEvent { /** * Allows to veto the shutdown. The veto can be a long running operation but it * will block the application from closing. */ veto(value: boolean | Promise): void; /** * The reason why the application will be shutting down. */ reason: ShutdownReason; } /** * An event that is send out when the window is about to close. Clients have a chance to veto * the closing by either calling veto with a boolean "true" directly or with a promise that * resolves to a boolean. Returning a promise is useful in cases of long running operations * on shutdown. * * Note: It is absolutely important to avoid long running promises if possible. Please try hard * to return a boolean directly. Returning a promise has quite an impact on the shutdown sequence! */ export interface WillShutdownEvent { /** * Allows to join the shutdown. The promise can be a long running operation but it * will block the application from closing. */ join(promise: Promise): void; /** * The reason why Code will be shutting down. */ reason: ShutdownReason; } /** * An event that is send out when the window closes. Clients have a chance to join the closing * by providing a promise from the join method. Returning a promise is useful in cases of long * running operations on shutdown. * * Note: It is absolutely important to avoid long running promises if possible. Please try hard * to return a boolean directly. Returning a promise has quite an impact on the shutdown sequence! */ export interface ShutdownEvent { /** * Allows to join the shutdown. The promise can be a long running operation but it * will block the application from closing. */ join(promise: Promise): void; /** * The reason why Code is shutting down. */ reason: ShutdownReason; } export declare const enum ShutdownReason { /** Window is closed */ CLOSE = 1, /** Application is quit */ QUIT = 2, /** Window is reloaded */ RELOAD = 3, /** Other configuration loaded into window */ LOAD = 4 } export declare const enum StartupKind { NewWindow = 1, ReloadedWindow = 3, ReopenedWindow = 4 } export declare const enum LifecyclePhase { /** * The first phase signals that we are about to startup getting ready. */ Starting = 1, /** * Services are ready and the view is about to restore its state. */ Ready = 2, /** * Views, panels and editors have restored. For editors this means, that * they show their contents fully. */ Restored = 3, /** * The last phase after views, panels and editors have restored and * some time has passed (few seconds). */ Eventually = 4 } /** * A lifecycle service informs about lifecycle events of the * application, such as shutdown. */ export interface ILifecycleService { /** * Value indicates how this window got loaded. */ readonly startupKind: StartupKind; /** * A flag indicating in what phase of the lifecycle we currently are. */ phase: LifecyclePhase; /** * Fired before shutdown happens. Allows listeners to veto against the * shutdown. */ readonly onWillShutdown: Event; /** * Fired when the shutdown is about to happen after long running shutdown operations * have finished (from onWillShutdown). This is the right place to dispose resources. */ readonly onShutdown: Event; /** * Returns a promise that resolves when a certain lifecycle phase * has started. */ when(phase: LifecyclePhase): Promise; } export declare const NullLifecycleService: ILifecycleService;