My Electron application opens, besides its main window, various secondary windows.
The preload.ts
file is called every time one of the windows is created.
Preload define an event listener for "DOMContentLoaded"
.
Is this listener automatically removed when I close the corresponding window or should I remove it manually? In this case how? (I'm fighting leaks right now...)
Electron 35.0.0 on Windows 11 64 bits
If you're using context isolation as recommended by Electron, each window should have its own context and window object. That would prevent the leak as each window object is separate and would be removed alongside the closed window.