Interface WindowService

interface WindowService {
    onUnload: Event<void>;
    focus(): void;
    isSafeToShutDown(reason): Promise<boolean>;
    openNewDefaultWindow(params?): void;
    openNewWindow(url, options?): undefined;
    reload(params?): void;
    setSafeToShutDown(): void;
}

Implemented by

Properties

onUnload: Event<void>

Fires when the window unloads. The unload event is inevitable. On this event, the frontend application can save its state and release resource. Saving the state and releasing any resources must be a synchronous call. Any asynchronous calls invoked after emitting this event might be ignored.

Methods

  • Checks FrontendApplicationContribution#willStop for impediments to shutdown and runs any actions returned. Can be used safely in browser and Electron when triggering reload or shutdown programmatically. Should only be called before a shutdown - if this returns true, FrontendApplicationContribution#willStop will not be called again in the current session. I.e. if this return true, the shutdown should proceed without further condition.

    Parameters

    Returns Promise<boolean>

  • Opens a new window and loads the content from the given URL. In a browser, opening a new Theia tab or open a link is the same thing. But in Electron, we want to open links in a browser, not in Electron.

    Parameters

    Returns undefined

  • Will prevent subsequent checks of FrontendApplicationContribution#willStop. Should only be used after requesting user confirmation.

    This is primarily intended programmatic restarts due to e.g. change of display language. It allows for a single confirmation of intent, rather than one warning and then several warnings from other contributions.

    Returns void