Skip to main content

Electron 简单示例

· 4 min read

我们最近在 GitHub 总部为 Hackbright 学院(一家位于旧金山的女性编程学校)的成员举办了一场 Electron 黑客马拉松。为了帮助参会者快速上手项目,我们自己的 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: