UNPKG

2.5 kBTypeScriptView Raw
1import { Event, Emitter } from '../../common';
2import { CorePreferences } from '../core-preferences';
3import { ContributionProvider } from '../../common/contribution-provider';
4import { FrontendApplicationContribution, FrontendApplication, OnWillStopAction } from '../frontend-application';
5import { WindowService } from './window-service';
6import { StopReason } from '../../common/frontend-application-state';
7export declare class DefaultWindowService implements WindowService, FrontendApplicationContribution {
8 protected frontendApplication: FrontendApplication;
9 protected allowVetoes: boolean;
10 protected onUnloadEmitter: Emitter<void>;
11 get onUnload(): Event<void>;
12 protected readonly corePreferences: CorePreferences;
13 protected readonly contributions: ContributionProvider<FrontendApplicationContribution>;
14 onStart(app: FrontendApplication): void;
15 openNewWindow(url: string): undefined;
16 openNewDefaultWindow(): void;
17 /**
18 * Returns a list of actions that {@link FrontendApplicationContribution}s would like to take before shutdown
19 * It is expected that this will succeed - i.e. return an empty array - at most once per session. If no vetoes are received
20 * during any cycle, no further checks will be made. In that case, shutdown should proceed unconditionally.
21 */
22 protected collectContributionUnloadVetoes(): OnWillStopAction[];
23 /**
24 * Implement the mechanism to detect unloading of the page.
25 */
26 protected registerUnloadListeners(): void;
27 isSafeToShutDown(stopReason: StopReason): Promise<boolean>;
28 setSafeToShutDown(): void;
29 /**
30 * Called when the `window` is about to `unload` its resources.
31 * At this point, the `document` is still visible and the [`BeforeUnloadEvent`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event)
32 * event will be canceled if the return value of this method is `false`.
33 *
34 * In Electron, handleCloseRequestEvent is is run instead.
35 */
36 protected handleBeforeUnloadEvent(event: BeforeUnloadEvent): string | void;
37 /**
38 * Notify the browser that we do not want to unload.
39 *
40 * Notes:
41 * - Shows a confirmation popup in browsers.
42 * - Prevents the window from closing without confirmation in electron.
43 *
44 * @param event The beforeunload event
45 */
46 protected preventUnload(event: BeforeUnloadEvent): string | void;
47 reload(): void;
48}
49//# sourceMappingURL=default-window-service.d.ts.map
\No newline at end of file