ProtectedallowProtected ReadonlycontributionsProtected ReadonlycoreProtectedfrontendProtected ReadonlyloggerProtectedonProtectedunloadedCloses a window previously opened by openNewDefaultWindow.
the identifier returned by openNewDefaultWindow. No-op if the window does not exist or the platform does not support it.
ProtectedcollectReturns a list of actions that FrontendApplicationContributions would like to take before shutdown It is expected that this will succeed - i.e. return an empty array - at most once per session. If no vetoes are received during any cycle, no further checks will be made. In that case, shutdown should proceed unconditionally.
Reveal and focuses the current window
ProtectedhandleCalled when the window is about to unload its resources.
At this point, the document is still visible and the BeforeUnloadEvent
event will be canceled if the return value of this method is false.
In Electron, handleCloseRequestEvent is is run instead.
ProtectedhandleFires onUnload at most once per document: pagehide fires again for the reload that
recovers a page restored from the back/forward cache, but the application is already stopped.
Protectedhandlepagehide also fires when the page enters the back/forward cache, in which case the frontend
has already shut down (state saved, connections closed). Reload to get a working application
again if the page is restored from the cache. That shutdown already happened, so the reload
must not be vetoed by the contributions.
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.
Called when the application is started. The application shell is not attached yet when this method runs. Should return a promise if it runs asynchronously.
Opens a new default window.
a window identifier that can be passed to closeWindow, or -1 if not supported.
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.
ProtectedpreventNotify the browser that we do not want to unload.
Notes:
The beforeunload event
Protectedregisterpagehide is used instead of the deprecated unload event, which Chrome may block
via permissions policy (https://developer.chrome.com/docs/web-platform/deprecating-unload),
silently skipping the handler and thus e.g. losing the layout.
ProtectedregisterImplement the mechanism to detect unloading of the page.
Reloads the window according to platform.
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.
Fires when the application is shutting down. 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.