@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
50 lines • 2.56 kB
TypeScript
import { Event, Emitter } from '../../common';
import { CorePreferences } from '../core-preferences';
import { ContributionProvider } from '../../common/contribution-provider';
import { FrontendApplicationContribution, OnWillStopAction } from '../frontend-application-contribution';
import { WindowService } from './window-service';
import { StopReason } from '../../common/frontend-application-state';
import { FrontendApplication } from '../frontend-application';
export declare class DefaultWindowService implements WindowService, FrontendApplicationContribution {
protected frontendApplication: FrontendApplication;
protected allowVetoes: boolean;
protected onUnloadEmitter: Emitter<void>;
get onUnload(): Event<void>;
protected readonly corePreferences: CorePreferences;
protected readonly contributions: ContributionProvider<FrontendApplicationContribution>;
onStart(app: FrontendApplication): void;
openNewWindow(url: string): undefined;
openNewDefaultWindow(): void;
/**
* Returns a list of actions that {@link FrontendApplicationContribution}s would like to take before shutdown
* It is expected that this will succeed - i.e. return an empty array - at most once per session. If no vetoes are received
* during any cycle, no further checks will be made. In that case, shutdown should proceed unconditionally.
*/
protected collectContributionUnloadVetoes(): OnWillStopAction[];
/**
* Implement the mechanism to detect unloading of the page.
*/
protected registerUnloadListeners(): void;
isSafeToShutDown(stopReason: StopReason): Promise<boolean>;
setSafeToShutDown(): void;
/**
* Called when the `window` is about to `unload` its resources.
* At this point, the `document` is still visible and the [`BeforeUnloadEvent`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event)
* event will be canceled if the return value of this method is `false`.
*
* In Electron, handleCloseRequestEvent is is run instead.
*/
protected handleBeforeUnloadEvent(event: BeforeUnloadEvent): string | void;
/**
* Notify the browser that we do not want to unload.
*
* Notes:
* - Shows a confirmation popup in browsers.
* - Prevents the window from closing without confirmation in electron.
*
* @param event The beforeunload event
*/
protected preventUnload(event: BeforeUnloadEvent): string | void;
reload(): void;
}
//# sourceMappingURL=default-window-service.d.ts.map