Appearance
Window Module
The window module provides methods to manage the native app windows. It allows you to open new windows, close or minimize existing ones, toggle fullscreen mode, and control developer tools. This module is essential for applications that require multiple windows or advanced window management features.
Overview
Common use cases for the window module include:
- Opening additional windows.
- Controlling developer tools (DevTools) for debugging purposes.
- Managing fullscreen, minimized and maximized modes.
- Closing specific windows by their unique labels.
API Reference
| Method | Description |
|---|---|
devTools.toggle(label?) | Toggles the developer tools for the specified window (default: main). |
devTools.open(label?) | Opens the developer tools for the specified window (default: main). |
devTools.close(label?) | Closes the developer tools for the specified window (default: main). |
new(options?) | Opens a new window with optional parameters: label (string), url (string), and fullscreen (boolean). |
close(label) | Closes a specific window by its unique label. |
minimize() | Minimizes the active window. |
maximizeToggle() | Toggles between maximizing and restoring the active window. |
fullscreen(enable) | Enables or disables fullscreen mode for the active window. |
Method Details
devTools.toggle(label?: string): Promise<void>
Toggles the developer tools panel for the window identified bylabel. If no label is provided, it defaults to the main window.devTools.open(label?: string): Promise<void>
Opens the developer tools panel for the specified window.devTools.close(label?: string): Promise<void>
Closes the developer tools panel for the specified window.new(options?: { label?: string; url?: string; fullscreen?: boolean }): Promise<void>
Opens a new window. You can specify a uniquelabelfor the window, aurlto load, and whether the window should start infullscreenmode.close(label: string): Promise<void>
Closes the window identified by the givenlabel.minimize(): Promise<void>
Minimizes the currently active window.maximizeToggle(): Promise<void>
Toggles the currently active window between maximized and restored states.fullscreen(enable: boolean): Promise<void>
Enables (true) or disables (false) fullscreen mode for the active window.
Notes
TIP
Each window has a unique label that is used as a reference by the bridge. This label is essential for targeting specific windows when calling methods like close, devTools.open, or devTools.toggle. The label for the main window is main.
WARNING
Some operations might not behave the same on every platform, always test any implementation.