当前位置:网站首页>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。我们可以通过运行创建我们
边栏推荐
- SVG大写字母A动画js特效
- NFT 项目的开发、部署、上线的流程(2)
- El dialog drag and drop, the boundary problem is completely corrected, and the bug of the online version is fixed
- Solana扩容机制分析(1):牺牲可用性换取高效率的极端尝试 | CatcherVC Research
- R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over discrete, and use the ratio of residual deviation and residual degr
- Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law
- 9 Tensorboard的使用
- Solana capacity expansion mechanism analysis (1): an extreme attempt to sacrifice availability for efficiency | catchervc research
- Audio and video learning (II) -- frame rate, code stream and resolution
- 请指教同花顺软件究竟是什么?网上开户是否安全么?
猜你喜欢

Big talk Domain Driven Design -- presentation layer and others

SVG大写字母A动画js特效

李飞飞团队将ViT用在机器人身上,规划推理最高提速512倍,还cue了何恺明的MAE...

Angel 3.2.0 new version released! Figure the computing power is strengthened again

canvas三个圆点闪烁动画

9 use of tensorboard

若依如何实现接口限流?

Quickly get started with federal learning -- the practice of Tencent's self-developed federal learning platform powerfl

今年高考英语AI得分134,复旦武大校友这项研究有点意思

SAP OData 开发教程 - 从入门到提高(包含 SEGW, RAP 和 CDP)
随机推荐
9 use of tensorboard
Transaction input data of Ethereum
6 custom layer
Have you ever had a Kindle with a keyboard?
Golang temporary object pool optimization
IntelliJ idea -- Method for formatting SQL files
How to create your own NFT (polygon) on opensea
Transformation of zero knowledge QAP problem
01 backpack DP
Panoramic analysis of upstream, middle and downstream industrial chain of "dry goods" NFT
(1) Keras handwritten numeral recognition and recognition of self written numbers
NFT transaction principle analysis (2)
How to identify contractual issues
Leetcode one week race 298, first three questions
Canvas three dot flashing animation
R语言plotly可视化:小提琴图、多分类变量小提琴图、分组(grouped)小提琴图、分裂的分组小提琴图、每个小提琴图内部分为两组数据、每个分组占小提琴图的一半、自定义小提琴图的调色板、抖动数据点
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
若依如何实现接口限流?
Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
Beijing University and Tencent jointly build angel4.0, and the self-developed in-depth learning framework "River map" is integrated into the ecology