Managing your app's window lifecycle Īpplication windows behave differently on each operating system. Renderer processes have access to the same JavaScript APIs and tooling you use for typical front-end web development, such as using webpack to bundle and minify your code or React to build your user interfaces. See electron/electron#21972 for details.Īt this point, running your Electron application's start command should successfully open a window that displays your web page!Įach web page your app displays in a window will run in a separate process called a renderer process (or simply renderer for short). However, Electron exposes app.whenReady() as a helper specifically for the ready event to avoid subtle pitfalls with directly listening to that event in particular. Create a main.js file in the root folder of your project with a single line of code: This script controls the main process, which runs in a Node.js environment and is responsible for controlling your app's lifecycle, displaying native interfaces, performing privileged operations, and managing renderer processes (more on that later).īefore creating your first Electron app, you will first use a trivial script to ensure your main process entry point is configured correctly. The main script you defined in package.json is the entry point of any Electron application. Read Electron's process model documentation to better understand how Electron's multiple processes work together. You should place a copy of GitHub's Node.js gitignore template into your project's root folder to avoid committing your project's node_modules folder. gitignore file specifies which files and directories to avoid tracking with Git. If installing Electron directly fails, please refer to our Advanced Installation documentation for instructions on download mirrors, proxies, and troubleshooting steps.
0 Comments
Leave a Reply. |