Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save santiago-puchginer-snkeos/38a54514eafcdeb77155a9b748003a72 to your computer and use it in GitHub Desktop.
Save santiago-puchginer-snkeos/38a54514eafcdeb77155a9b748003a72 to your computer and use it in GitHub Desktop.
Electron overview

Multi-process architecture

  • Main process: in charge of creating web pages by creating BrowserWindow instances. Manages all web pages and their corresponding renderer process
  • Renderer process: process assigned to each web page to be rendered. Runs a BrowserWindow instance (previously created by the main process). ATTENTION: it can't manage GUI resources itself, instead it must communicate with the main process to request that the main process performs those operations, for example using the remote module (for RPC style communication).

Browser Window

Class that gives you the ability to create a browser window. It inherits from EventEmitter. In the main process: const BrowserWindow = require('electron').BrowserWindow; In a renderer process: const BrowserWindow = require('electron').remote.BrowserWindow;

WebContents

Responsible for rendering a page and controlling it, and is a property of the BrowserWindow object. var webContents = win.webContents; It inherits from EventEmitter.

App

The app module is reponsible for controlling the application's lifecycle. It emits several events. const app = require('electron').app;

Menu

The menu class is used to create native menus that can be used as application menus and context menus.

const remote = require('electron').remote;
const Menu = remote.Menu;
const MenuItem = remote.MenuItem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment