- Electron - Resources
- Electron - Packaging Apps
- Electron - Debugging
- Electron - Environment Variables
- Electron - Defining Shortcuts
- Electron - Audio & Video Capturing
- Electron - Webview
- Electron - Notifications
- Electron - System Tray
- Electron - Menus
- Electron - System Dialogs
- Inter Process Communication(IPC)
- Electron - Native Node Libraries
- Electron - File Handling
- Electron - Building UIs
- Electron - Hello World
- How Electron Works?
- Electron - Installation
- Electron - Overview
- Electron - Home
Electron Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
How Electron Works
Electron takes a main file defined in your package.json file and executes it. This main file creates apppcation windows which contain rendered web pages and interaction with the native GUI (graphical user interface) of your Operating System.
As you start an apppcation using Electron, a main process is created. This main process is responsible for interacting with the native GUI of the Operating System. It creates the GUI of your apppcation.
Just starting the main process does not give the users of your apppcation any apppcation window. These are created by the main process in the main file by using the BrowserWindow module. Each browser window then runs its own renderer process. The renderer process takes an HTML file which references the usual CSS files, JavaScript files, images, etc. and renders it in the window.
The main process can access the native GUI through modules available directly in Electron. The desktop apppcation can access all Node modules pke the file system module for handpng files, request to make HTTP calls, etc.
Difference between Main and Renderer processes
The main process creates web pages by creating the BrowserWindow instances. Each BrowserWindow instance runs the web page in its own renderer process. When a BrowserWindow instance is destroyed, the corresponding renderer process is also terminated.
The main process manages all web pages and their corresponding renderer processes. Each renderer process is isolated and only cares about the web page running in it.
Advertisements