Electron 简单示例
我们最近在 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:
-
electron-quick-start:极简 Electron 应用样板。
¥electron-quick-start: A minimal Electron application boilerplate.
-
Electron API 演示:一个演示 Electron API 核心功能的交互式应用
¥Electron API Demos: An interactive app that demonstrates the core features of the Electron API
-
electronjs.org/docs/all:所有 Electron 文档均集中到一个可搜索的页面上。
¥electronjs.org/docs/all: All of the Electron documentation together on a single searchable page.
-
hokein/electron-sample-apps:由 Electron 维护者 Haojian Wu 编译的另一个 Electron 示例应用集合。
¥hokein/electron-sample-apps: Another collection of sample applications for Electron, compiled by Electron maintainer Haojian Wu.
-
awesome-electron - GitHub 代码库,收集最新、最棒的 Electron 相关教程、书籍、视频等。
¥awesome-electron - A GitHub repository that collects the latest and greatest Electron-related tutorials, books, videos, etc.