UNPKG

2.58 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 focus(): void;
19 /**
20 * Returns a list of actions that {@link FrontendApplicationContribution}s would like to take before shutdown
21 * It is expected that this will succeed - i.e. return an empty array - at most once per session. If no vetoes are received
22 * during any cycle, no further checks will be made. In that case, shutdown should proceed unconditionally.
23 */
24 protected collectContributionUnloadVetoes(): OnWillStopAction[];
25 /**
26 * Implement the mechanism to detect unloading of the page.
27 */
28 protected registerUnloadListeners(): void;
29 isSafeToShutDown(stopReason: StopReason): Promise<boolean>;
30 setSafeToShutDown(): void;
31 /**
32 * Called when the `window` is about to `unload` its resources.
33 * At this point, the `document` is still visible and the [`BeforeUnloadEvent`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event)
34 * event will be canceled if the return value of this method is `false`.
35 *
36 * In Electron, handleCloseRequestEvent is is run instead.
37 */
38 protected handleBeforeUnloadEvent(event: BeforeUnloadEvent): string | void;
39 /**
40 * Notify the browser that we do not want to unload.
41 *
42 * Notes:
43 * - Shows a confirmation popup in browsers.
44 * - Prevents the window from closing without confirmation in electron.
45 *
46 * @param event The beforeunload event
47 */
48 protected preventUnload(event: BeforeUnloadEvent): string | void;
49 reload(): void;
50}
51//# sourceMappingURL=default-window-service.d.ts.map
\No newline at end of file