Skip to main content

Electron 简单示例

· 3 min read

我们最近在 GitHub 总部为 Hackbright Academy 的成员举办了一场 Electron 黑客马拉松,Hackbright Academy 是一家创立于旧金山的女性编程学校。为了帮助参与者提前启动他们的项目,我们的 Kevin Sawicki 创建了几个示例 Electron 应用。

🌐 We recently hosted an Electron hackathon at GitHub HQ for members of Hackbright Academy, a coding school for women founded in San Francisco. To help attendees get a head start on their projects, our own Kevin Sawicki created a few sample Electron applications.


如果你是 Electron 开发的新手,或者还没有尝试过它,这些示例应用是一个很好的起点。它们体积小、易于阅读,代码中有大量注释,解释了所有功能的工作原理。

🌐 If you're new to Electron development or haven't yet tried it out, these sample applications are a great place to start. They are small, easy to read, and the code is heavily commented to explain how everything works.

首先,请克隆此代码库:

🌐 To get started, clone this repository:

git clone https://github.com/electron/simple-samples

要运行以下任何一个应用,请先进入应用的目录,安装依赖,然后启动:

🌐 To run any of the apps below, change into the app's directory, install dependencies, then start:

cd activity-monitor
npm install
npm start

活动监视器

🌐 Activity Monitor

显示 CPU 系统、用户和空闲活动时间的环形图。

🌐 Shows a doughnut chart of the CPU system, user, and idle activity time.

哈希

🌐 Hash

显示使用不同算法计算的输入文本的哈希值。

🌐 Shows the hash values of entered text using different algorithms.

镜像

🌐 Mirror

以最大化的尺寸播放电脑摄像头的视频,就像照镜子一样。包括一个可选的彩虹滤镜效果,使用 CSS 动画实现。

🌐 Plays a video of the computer's camera at a maximized size like looking into a mirror. Includes an optional rainbow filter effect that uses CSS animations.

价格

🌐 Prices

使用 Yahoo 财经 API 显示石油、黄金和白银的当前价格。

🌐 Shows the current price of oil, gold, and silver using the Yahoo Finance API.

网址

🌐 URL

在窗口中加载通过命令行传递的 URL。

🌐 Loads a URL passed on the command line in a window.

其他资源

🌐 Other Resources

我们希望这些应用能帮助你开始使用 Electron。这里还有一些其他资源可以让你学习更多内容:

🌐 We hope these apps help you get started using Electron. Here are a handful other resources for learning more: