当前位置:网站首页>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

边栏推荐
猜你喜欢
随机推荐
openlayers版本更新差别
Mysql安装流程 【压缩版】
4KMILES加入艾盛集团,以更强劲的数字商务能力,加速中国跨境电商的全域全效增长
ShardingSphere-proxy +PostgreSQL实现读写分离(静态策略)
健康报告-设计与实现
Brain-computer interface 003 | Musk said that he has realized a virtual self-dialogue with the cloud, and related concept shares have risen sharply
【心理学 · 人物】第一期
NC | 土壤微生物组的结构和功能揭示全球湿地N2O释放
快速掌握jmeter(一)——实现自动登录与动态变量
斯堪尼亚SCANIA OTL标签介绍
日志框架学习
姑姑:给小学生出点口算题
el-tree渲染大量数据的解决方案(不通过懒加载)
leetcode刷题记录:7.整数反转,8.字符串转整数,9.回文数
golang刷leetcode 数学(1) 丑数系列
动态规划常见实例详解
MySQL安装配置教程(超级详细、保姆级)
7.21 - 每日一题 - 408
治疗 | 如何识别和处理消极想法
你想要的宏基因组-微生物组知识全在这(2022.8)