1

I'm trying to see if I understand how Electron's implementation of Node.js is done and how it interacts with the app. From my understanding, the startup web page has a javascript file that runs as a "renderer" process. Code in this script can also access any of the Node.js APIs. To create new browser windows, code in renderer script uses new BrowserWindow to create new windows and each window in turn has its own renderer script.

Code in the renderer scripts run under Node.js and as such any code written in these scripts cannot communicate with script code in the browser's web page.

Is all of this true or am I wrong on something?

1 Answer 1

1

The Electron main process can create new windows (with Browser Window) and each of those windows has a renderer process. You can use ipc to send messages between the renderer process and the main process. To send a message from one renderer process to another, there are plugins for that, or you just have to relay the message through the main process.

The format/appearance of each window is controlled via html and css. Part of creating a window is specifying the html file to load.

More info can be found in this other SO question. The other question referenced this repo which has more info.

Lastly, the consensus seems to be to put as much in the renderer as possible.

For more clarification, by

Code in the renderer scripts run under Node.js and as such any code written in these scripts cannot communicate with script code in the browser's web page.

are you asking if an Electron app can interact with a separate web browser?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.