UNPKG

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