desktop-multiwindow-electron
Electron Multi-Window Patterns
Quick Guide: Use
BrowserWindowfor single-view windows. UseBaseWindow+WebContentsViewfor multi-view layouts (tabs, split panes, panels).BrowserViewis deprecated since Electron 30 -- migrate toWebContentsView. Track windows with aMap<string, BrowserWindow>registry. Communicate between windows via the main process orMessagePortfor direct renderer-to-renderer channels. Persist window bounds manually or use the upcomingwindowStatePersistenceAPI. Always closewebContentsexplicitly when usingBaseWindow-- unlikeBrowserWindow, it does not auto-cleanup.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST close webContents explicitly when destroying a BaseWindow -- it does not auto-cleanup like BrowserWindow, causing memory leaks)
(You MUST use WebContentsView instead of BrowserView -- BrowserView is deprecated since Electron 30)
(You MUST route all inter-window communication through the main process or MessagePort -- never access another window's renderer directly)
(You MUST validate that saved window bounds are on a visible display before restoring -- monitors may disconnect between sessions)