添加功能
增加应用的复杂性
🌐 Adding application complexity
如果你一直在跟随教程,你应该已经拥有一个具有静态用户界面的可运行的 Electron 应用。从这个起点出发,你通常可以在两个大方向上继续开发你的应用:
🌐 If you have been following along, you should have a functional Electron application with a static user interface. From this starting point, you can generally progress in developing your app in two broad directions:
- 增加渲染器进程的 Web 应用代码的复杂性
- 与操作系统和 Node.js 更深入的集成
理解这两个广泛概念之间的区别非常重要。首先,Electron 特定的资源并不是必需的。在 Electron 中构建一个漂亮的待办事项列表,只需将你的 Electron BrowserWindow 指向一个漂亮的待办事项 web 应用。归根结底,你是在使用与网页上相同的工具(HTML、CSS、JavaScript)来构建渲染器的用户界面。因此,Electron 的文档不会深入讲解如何使用标准的网页工具。
🌐 It is important to understand the distinction between these two broad concepts. For the first point, Electron-specific resources are not necessary. Building a pretty to-do list in Electron is just pointing your Electron BrowserWindow to a pretty to-do list web app. Ultimately, you are building your renderer's UI using the same tools (HTML, CSS, JavaScript) that you would on the web. Therefore, Electron's docs will not go in-depth on how to use standard web tools.
另一方面,Electron 还提供了一整套丰富的工具,使你能够与桌面环境集成,从创建托盘图标到添加全局快捷键,再到显示原生菜单。它还在主进程中为你提供了完整的 Node.js 环境功能。这些能力使 Electron 应用区别于在浏览器标签中运行的网站,并且是 Electron 文档的重点内容。
🌐 On the other hand, Electron also provides a rich set of tools that allow you to integrate with the desktop environment, from creating tray icons to adding global shortcuts to displaying native menus. It also gives you all the power of a Node.js environment in the main process. This set of capabilities separates Electron applications from running a website in a browser tab, and are the focus of Electron's documentation.
操作方法示例
🌐 How-to examples
Electron 的文档有许多教程,帮助你了解更高级的主题和更深入的操作系统集成。要开始,请查看 操作示例 文档。
🌐 Electron's documentation has many tutorials to help you with more advanced topics and deeper operating system integrations. To get started, check out the How-To Examples doc.
如果你找不到所需的内容,请通过 GitHub 或在我们的 Discord 服务器 告诉我们!
🌐 If you can't find what you are looking for, please let us know on GitHub or in our Discord server!
下一步是什么?
🌐 What's next?
在本教程的剩余部分,我们将不再关注应用代码,而是向你展示如何将你的应用从开发者的电脑交付到终端用户手中。
🌐 For the rest of the tutorial, we will be shifting away from application code and giving you a look at how you can get your app from your developer machine into end users' hands.