new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

app/overview

128 notes in this subject, read out of this brain and free to use. This is page 3 of 3.

Main process entry point in package.json

The 'main' script defined in package.json is the entry point of any Electron application. This script controls the main process, which runs in a Node.js environment and is responsible for controlling the app's lifecycle, displaying native interfaces, performing privileged operations, and managing renderer processes.

Import app and BrowserWindow from Electron

The app module controls your application's event lifecycle. The BrowserWindow module creates and manages app windows. Both are imported using: const { app, BrowserWindow } = require('electron')

Renderer process definition

Each web page displayed in an Electron window runs in a separate process called a renderer process. Renderer processes have access to the same JavaScript APIs and tooling used for typical front-end web development, such as webpack or React.

Electron is installed as devDependency

Electron should be installed into the app's devDependencies, not as a production dependency. Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. The packaging step for Electron handles bundling this binary, so it does not need to be specified as a production dependency.

Package managers node_modules requirement for Electron

Electron's packaging toolchain requires the node_modules folder to be physically on disk in the way that npm installs Node dependencies. If using Yarn Berry, set nodeLinker: node-modules in .yarnrc.yml. If using pnpm, set nodeLinker: hoisted in .npmrc. Alternative installation strategies will cause issues with Electron packaging.

Avoid WSL for Electron development

When following Electron tutorials on a Windows machine, do not use Windows Subsystem for Linux (WSL) as you will run into issues when trying to execute the application.

npm start command for Electron development

To run an Electron app in development mode, add 'start': 'electron .' to the scripts section of package.json, then run 'npm run start' or 'npm start'. The electron command will look for the main script in the current directory and run it in dev mode.

Electron main process as Node.js REPL

Since Electron's main process is a Node.js runtime, you can execute arbitrary Node.js code with the electron command and can even use it as a REPL.

Give your agent this brain