当前位置:网站首页>Electron User Guide Beginning Experience
Electron User Guide Beginning Experience
2022-08-02 22:34:00 【The front-end code farmer wang】
Introduction to Electron
1. Overview
You must have heard that electrons can be used to build amazing desktop applications!
Many development languages, such as C and Java, have long retained the ability to generate desktop applications, but building applications in these languages is very difficult.


We leverage JavaScript, HTML and CSS web technologies to build a single application and then compile the application for Mac windows and Linux.

In addition, we can also use our favorite frameworks and libraries to implement this program, such as Vue, React and other front-end frameworks.



Electron is completely cross-platform, she is compatible with Mac, Windows and Linux, you can build applications for all three platforms.



Let's go firstBuild an Electron operating environment.
2. Principle of Electron
Before we learn about Electron in depth, it is necessary for us to understand Electron's application architecture.
Electron runs in two types of processes, one is the main process and the other is the rendering process. We must know that electron can only work based on chromium, so let's take a brief look at the chromium architecture:

Let's take a look at what electron has done on the basis of chromium:

- Renderer Process
In electron, the Renderer Process is still used to render pages, which means that the electron app uses web pages as UI display and is compatible with traditional web pages.The difference is that electron app developers can optionally configure whether to support Node.js.
- Main Process
electron has made a lot of changes to the Browser Process, so it is called Main Process by another name.Main Process In addition to the original chromium runtime, the Node.js runtime is added, and main.js runs on it.
electron connects the message loop of Node.js with chromium, so that js can flexibly control page display and IPC communication with Renderer Process.Inter-Process Communication (IPC, Inter-Process Communication) refers to some technologies or methods for transmitting data or signals between at least two processes or threads.Of course, the native Node API and third-party node modules are also supported, and there are electron APIs for developers to control native menus and notifications.One thing to note is that Browser Process has no js runtime, so it also needs to rely on V8 (of course, this is V8 in chromium, not a separate V8 library).

To sum up, a Main Process (main process) and one or more Rederers (rendering process) constitute the operating structure of Electron.Let's call the main process the Server-side server and the rederen process the client.
- electron uses Node.js native modules

边栏推荐
猜你喜欢
随机推荐
线程池原理与实践|从入门到放弃,深度解析
7.22 - 每日一题 - 408
【学习日记】win64配置openni的vs2022编译环境
golang刷leetcode 动态规划(13) 最长公共子序列
Brain-computer interface 003 | Musk said that he has realized a virtual self-dialogue with the cloud, and related concept shares have risen sharply
十六进制文本的字节序问题
SQL-UDT是什么功能?
Based on OpenGL glaciers and firebird (illumination calculation model, visual, particle system)
Geoserver+mysql+openlayers2
7月29-31 | APACHECON ASIA 2022
【LeetCode】118. 杨辉三角 - Go 语言题解
Mysql基础篇(视图)
扫码预约 | 观看Apache Linkis数据处理实践以及计算治理能力
Geoserver+mysql+openlayers2
技术分享 | Apache Linkis 快速集成网页IDE工具 Scriptis
7.23 - 每日一题 - 408
分享一个 web 应用版本监测 (更新) 的工具库
Flutter自带国际化适配自动生成方案
我用这一招让团队的开发效率提升了 100%!
J9数字货币论:识别Web3新的稀缺性:开源开发者