electron/services/window/WindowService
Window management service for Electron application windows.
Remarks
Handles the creation, configuration, and lifecycle management of Electron browser windows. Provides a centralized service for window operations including content loading, event handling, and renderer communication.
Key responsibilities:
- Create and configure the main application window
- Load appropriate content based on the current environment
- Handle window lifecycle events (ready-to-show, closed, etc.)
- Manage window state and provide convenience accessors
- Facilitate communication between main and renderer processes
The service automatically handles environment-specific loading:
- Development: Loads from the Vite dev server and opens DevTools
- Production: Loads from built static files in the application bundle
Example
const windowService = new WindowService();
const mainWindow = windowService.createMainWindow();
if (windowService.hasMainWindow()) {
// Window operations...
}