1 | import { StopReason } from '../../common/frontend-application-state';
|
2 | import { Event } from '../../common/event';
|
3 | import { NewWindowOptions } from '../../common/window';
|
4 | /**
|
5 | * Service for opening new browser windows.
|
6 | */
|
7 | export declare const WindowService: unique symbol;
|
8 | export interface WindowService {
|
9 | /**
|
10 | * Opens a new window and loads the content from the given URL.
|
11 | * In a browser, opening a new Theia tab or open a link is the same thing.
|
12 | * But in Electron, we want to open links in a browser, not in Electron.
|
13 | */
|
14 | openNewWindow(url: string, options?: NewWindowOptions): undefined;
|
15 | /**
|
16 | * Opens a new default window.
|
17 | * - In electron and in the browser it will open the default window without a pre-defined content.
|
18 | */
|
19 | openNewDefaultWindow(): void;
|
20 | /**
|
21 | * Fires when the `window` unloads. The unload event is inevitable. On this event, the frontend application can save its state and release resource.
|
22 | * Saving the state and releasing any resources must be a synchronous call. Any asynchronous calls invoked after emitting this event might be ignored.
|
23 | */
|
24 | readonly onUnload: Event<void>;
|
25 | /**
|
26 | * Checks `FrontendApplicationContribution#willStop` for impediments to shutdown and runs any actions returned.
|
27 | * Can be used safely in browser and Electron when triggering reload or shutdown programmatically.
|
28 | * Should _only_ be called before a shutdown - if this returns `true`, `FrontendApplicationContribution#willStop`
|
29 | * will not be called again in the current session. I.e. if this return `true`, the shutdown should proceed without
|
30 | * further condition.
|
31 | */
|
32 | isSafeToShutDown(reason: StopReason): Promise<boolean>;
|
33 | /**
|
34 | * Will prevent subsequent checks of `FrontendApplicationContribution#willStop`. Should only be used after requesting
|
35 | * user confirmation.
|
36 | *
|
37 | * This is primarily intended programmatic restarts due to e.g. change of display language. It allows for a single confirmation
|
38 | * of intent, rather than one warning and then several warnings from other contributions.
|
39 | */
|
40 | setSafeToShutDown(): void;
|
41 | /**
|
42 | * Reloads the window according to platform.
|
43 | */
|
44 | reload(): void;
|
45 | }
|
46 | //# sourceMappingURL=window-service.d.ts.map |
\ | No newline at end of file |