当前位置:网站首页>JS教程之 使用 Electron.JS 构建原生桌面应用程序乒乓游戏
JS教程之 使用 Electron.JS 构建原生桌面应用程序乒乓游戏
2022-06-26 15:54:00 【知识大胖】
Javascript 被浏览器束缚的日子已经一去不复返了。Electron 或 Electron.js 是由 OpenJS 基金会维护的框架,用于使用 JavaScript、HTML 和 CSS 等 Web 技术构建本地桌面应用程序。

越来越多的原生应用程序,如 Spotify、VSCode 和 Slack,都在使用 Electron 构建!
该开源框架使用 Chromium 和 Node.js,可用于创建与 Windows、Mac 和 Linux 兼容的跨平台应用程序。在本文中,我们将使用 Electron 构建一个可以在本地运行的简单井字游戏。
Electron.JS基础
Electron.JS由三个主要成分组成:
- 处理所有 Web 内容的 Chromium
- 处理与操作系统交互的 Node.js
- 用于附加功能的自定义 API,并在处理操作系统时解决常见问题
所有这些组件一起工作以促进桌面应用程序。
此外,Electron 包括两个主要过程。主进程处理窗口管理、所有操作系统交互,渲染器进程负责网页内容。
渲染器进程不能直接与操作系统交互,只能通过主进程与之通信。根据应用程序,一个主进程可以有多个渲染器进程。但是,在大多数情况下,使用带有用于加载 Web 应用程序的单个渲染器的单个主进程。
解释完之后,让我们开始构建吧。
设置我们的项目
要使用 Electron,您需要在您的环境中安装 Node.js。我们可以通过运行创建我们
边栏推荐
- Simple use of tensor
- [untitled]
- 零知识 QAP 问题的转化
- Development, deployment and online process of NFT project (2)
- JS text scrolling scattered animation JS special effect
- 精致妆容成露营“软实力”,唯品会户外美妆护肤产品销量激增
- R语言plotly可视化:plotly可视化归一化的直方图(historgram)并在直方图中添加密度曲线kde、并在直方图的底部边缘使用geom_rug函数添加边缘轴须图
- 理想路径问题
- 8 自定义评估函数
- 9 Tensorboard的使用
猜你喜欢

SAP OData 开发教程 - 从入门到提高(包含 SEGW, RAP 和 CDP)

基于 MATLAB的自然过渡配音处理方案探究

Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law

Transformation of zero knowledge QAP problem

Beijing University and Tencent jointly build angel4.0, and the self-developed in-depth learning framework "River map" is integrated into the ecology

El dialog drag and drop, the boundary problem is completely corrected, and the bug of the online version is fixed

Have you ever had a Kindle with a keyboard?

Handwritten numeral recognition, run your own picture with the saved model

SVG大写字母A动画js特效

Solana capacity expansion mechanism analysis (1): an extreme attempt to sacrifice availability for efficiency | catchervc research
随机推荐
SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)
svg野人动画代码
"C language" question set of ⑩
R language plot visualization: plot visualizes the normalized histogram, adds the density curve KDE to the histogram, and uses geom at the bottom edge of the histogram_ Adding edge whisker graph with
9 Tensorboard的使用
NFT contract basic knowledge explanation
Nanopi duo2 connection WiFi
理想路径问题
This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
I want to know how to open an account through online stock? Is online account opening safe?
IntelliJ idea -- Method for formatting SQL files
How to identify contractual issues
5000 word analysis: the way of container security attack and defense in actual combat scenarios
NFT 平台安全指南(1)
Svg savage animation code
mha 切换(操作流程建议)
6 custom layer
3. Keras version model training
NFT Platform Security Guide (2)
Keepalived 实现 Redis AutoFailover (RedisHA)1