Interface · Application Lifecycle
DesktopApplication
Desktop application lifetime and window manager.
@sharpts/gui · SharpTS 572a2e31be0eMembers
isDisposed
readonly isDisposed: booleanWhether the application lifetime has been disposed.
Type: boolean
windowCount
readonly windowCount: numberNumber of currently open application windows.
Type: number
createTrayIcon
createTrayIcon(options: TrayIconOptions): DesktopTrayIconCreates a native system tray icon.
Remarks
The application owns the icon, but callers should dispose it as soon as it is no longer needed.
Throws
- When the application is disposed or the icon or menu configuration is invalid.
Examples
const tray = app.createTrayIcon({ icon: "assets/app.ico", toolTip: "SharpTS" });createWindow
createWindow(element: GuiChild, options?: DesktopWindowOptions): DesktopWindowCreates and synchronously performs the initial render of a native window.
Remarks
Await the window's closed promise when later work depends on its lifetime, and dispose the application when it is no longer needed.
Throws
- When the application is disposed, the owner belongs to another application, or the initial render fails.
Examples
const window = app.createWindow(<Window title="Dashboard" />);dispose
dispose(): voidDisposes all windows, tray icons, and application resources.
Remarks
Disposing the application is terminal; create a new application lifetime to open more windows.
Examples
app.dispose();shutdown
shutdown(exitCode?: number): voidEnds the desktop message loop with an optional process exit code.
Remarks
Shutdown requests loop termination; dispose remains responsible for releasing application resources.
Examples
app.shutdown(0);Related symbols
Source
src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1134 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.