I want to clarify that I am not an expert in node.js and much less in electron, I am making this application for personal use and as I learn about the use of javascript focused on the backend with node.js, it is possible that I am not applying community conventions or best practices.
I have managed to get the solution in the following way:
whenReady
.IpcController
passing as argument windowManager
.mainWindow
, for rendering.IpcController
the mainWindow
resulting from the window creation..await app.whenReady();
this.ipcController = new IpcController(
this.windowManager,
this.backendController,
this.appConfig
);
this.mainWindow = await this.windowManager.createMainWindow();
this.ipcController.setMainWindow(this.mainWindow);
The new method in ipcController
is:
setMainWindow(window) {
this.windowManager.mainWindow = window;
}
With this order and logic, both the content handlers and those associated with interactions of the created window work correctly.
I think the answer I found only works for event control of rendered content so it is not a general solution.