当前位置:网站首页>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。我们可以通过运行创建我们
边栏推荐
- Transformation of zero knowledge QAP problem
- 全面解析Discord安全问题
- Ideal path problem
- OpenSea上如何创建自己的NFT(Polygon)
- 「幹貨」NFT 上中下遊產業鏈全景分析
- Everyone is a scientist free gas experience Mint love crash
- R语言plotly可视化:plotly可视化归一化的直方图(historgram)并在直方图中添加密度曲线kde、并在直方图的底部边缘使用geom_rug函数添加边缘轴须图
- 牛客小白月赛50
- 李飞飞团队将ViT用在机器人身上,规划推理最高提速512倍,还cue了何恺明的MAE...
- What is the difference between stm32f1 and gd32f1?
猜你喜欢
Svg canvas canvas drag
This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law
NFT交易原理分析(2)
Application of ansible automation
2 three modeling methods
Tencent Peking University's sparse large model training acceleration program het was selected into the VLDB of the international summit
1 张量的简单使用
NFT 项目的开发、部署、上线的流程(1)
零知识 QAP 问题的转化
随机推荐
The first batch in the industry! Tencent cloud security and privacy computing products based on angel powerfl passed CFCA evaluation
Big talk Domain Driven Design -- presentation layer and others
01 backpack DP
2 three modeling methods
Svg capital letter a animation JS effect
Analyse panoramique de la chaîne industrielle en amont, en aval et en aval de la NFT « Dry goods»
Solidus labs welcomes zhaojiali, former head of financial innovation in Hong Kong, as a strategic adviser
Keepalived 实现 Redis AutoFailover (RedisHA)1
R语言plotly可视化:plotly可视化归一化的直方图(historgram)并在直方图中添加密度曲线kde、并在直方图的底部边缘使用geom_rug函数添加边缘轴须图
How to create your own NFT (polygon) on opensea
大话领域驱动设计——表示层及其他
Angel 3.2.0 new version released! Figure the computing power is strengthened again
Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law
svg野人动画代码
Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's Mae
理想路径问题
Audio and video learning (II) -- frame rate, code stream and resolution
请指教同花顺软件究竟是什么?网上开户是否安全么?
H5 close the current page, including wechat browser (with source code)
Solana capacity expansion mechanism analysis (2): an extreme attempt to sacrifice availability for efficiency | catchervc research