Is invisible window a counterpart of mutitiple process?


#1

I found there is a demo called “Communication with an invisible window”.
As we all know, javascript has only one process, so a CPU heavy work can easily freeze the UI interface for a web app.

I wondered, is the insivible window can be used to solve this problem? Like another process?
Thanks.


#2

Electron creates a separate process for each BrowserWindow, invisible or not, so yes you can offload work to an invisible window, or you can just spawn/fork a child process if you don’t need Chromium features in your background process.


#3

Great, finally it is possible to write a js app that can beat other lanuage based app.
Thank you very much.

BTW, when you say child process, do you mean start a new process in the Main Process (the node process)?


#4

I mean use the Node child_process API. Node APIs are available in the main process and the renderer processes associated with BrowserWindow(s) and webviews (unless Node integration is disabled, in which case you can still access Node APIs in the preload script).


#5

Thank you very much!