Electron

Electron is a library to develop cross-platform applications in JavaScript. You can use it with frameworks such as Vue.js, React, Angular, or simply HTML+CSS.

Electron is running your application in a Chromium web browser. If enabled, you can open the devtools with CTRL+SHIFT+I.

Some applications made using electron are VSCode, Discord, GitHub Desktop, MongoDBCompass, and Microsoft Teams...

Electron is following a fast-moving development pace, so there are frequently releasing major releases πŸ˜₯.

Other interesting projects


β˜„οΈ Electron ~v12 β˜„οΈ

Run electron in the current directory

{
  "scripts": {
    "start": "electron ."
  }
}

Creating a Window

mainWindow = new BrowserWindow({
    // some properties
    width: 1080, height: 720, icon: "...",
    webPreferences: {
        // ❌ loaded before each view
        // seems deprecated
        preload: path.join(__dirname, './src/preload.js'),
        // ❌ enable remote, deprecated
        // https://github.com/electron/remote
        // ipcRenderer should be used instead
        enableRemoteModule: true
    }
});

Random notes

➑️Open devtools on start, or disable devtools

// Open the DevTools.
mainWindow.webContents.openDevTools();

// Close the DevTools
mainWindow.webContents.on("devtools-opened", () => {
    mainWindow.webContents.closeDevTools();
});

πŸ‘» To-do πŸ‘»

Stuff that I found, but never read/used yet.