维护者峰会2022回顾
🌐 Maintainer Summit 2022 Recap
上个月,Electron 的维护者团队在加拿大温哥华聚会,讨论了 2023 年及以后的项目发展方向。在为期四天的会议室讨论中,核心维护者和受邀的合作者讨论了新的计划、维护中的痛点以及项目的整体健康状况。
🌐 Last month, Electron’s maintainer group met up in Vancouver, Canada to discuss the direction of the project for 2023 and beyond. Over four days in a conference room, core maintainers and invited collaborators discussed new initiatives, maintenance pain points, and general project health.

合影!由 @groundwater拍摄。
今后,团队仍将全力致力于发布定期且快速的 Chromium 升级,修复漏洞,并让 Electron 对所有人来说更安全、更高效。我们也有一些令人兴奋的项目正在进行中,期待与社区分享!
🌐 Going forward, the team will still be fully dedicated to releasing regular and rapid Chromium upgrades, fixing bugs, and making Electron more secure and performant for everyone. We also have a few exciting projects in the works we would love to share with the community!
变革性的新 API
🌐 Transformative new APIs
Electron 项目中需要达成共识的主要 API 提案会经过征求意见稿(RFC)进程,由我们的 API 工作组成员进行审查。
🌐 Major API proposals in the Electron project that require consensus go through a Request for Comments (RFC) process, which gets reviewed by members of our API Working Group.
今年,我们推动了两项具有潜力为 Electron 应用解锁新功能维度的重大提案。这些提案仍处于高度实验阶段,但这里给大家抢先看一下未来的可能!
🌐 This year, we have driven forward two major proposals that have the potential to unlock a new dimension of capabilities for Electron apps. These proposals are highly experimental, but here’s a sneak peek of what to expect!
新的原生插件增强功能 (C API)
🌐 New native addon enhancements (C APIs)
本提案概述了一个新的 Electron C API 层,它将允许应用开发者编写自己的本地 Node 插件,以接口与 Electron 的内部资源,类似于 Node 自身的 Node-API。关于拟议的新 API 的更多信息可以在这里找到。
🌐 This proposal outlines a new layer of Electron C APIs that will allow app developers to write their own Native Node Addons that interface with Electron’s internal resources, similar to Node’s own Node-API. More information about the proposed new API can be found here.
示例:使用 Chromium 资源强化应用
🌐 Example: Supercharging apps with Chromium resources
许多 Electron 应用维护自己的分支,以直接与 Chromium 内部交互,这些内部在普通(未修改的)Electron 中是无法访问的。通过在 C API 层暴露这些资源,这段代码可以作为一个原生模块与 Electron 一起运行,从而可能减少应用开发者的维护负担。
🌐 Many Electron apps maintain their own forks to interact directly with Chromium internals that would otherwise be inaccessible with vanilla (unmodified) Electron. By exposing these resources in the C API layer, this code can instead live as a native module alongside Electron, potentially reducing app developer maintenance burden.
公开 Chromium 的 UI 层(Views API)
🌐 Exposing Chromium’s UI layer (Views API)
在底层,Chrome 的用户界面(UI)中非网站部分,如工具栏、标签或按钮,是使用一种名为 Views 的框架构建的。Views API 提案将该框架的部分内容作为 JavaScript 类引入 Electron,最终目标是允许开发者为他们的 Electron 应用创建非网页 UI 元素。这将避免应用不得不拼凑网页内容。
🌐 Under the hood, the non-website parts of Chrome’s user interface (UI), such as toolbars, tabs, or buttons, are built with a framework called Views. The Views API proposal introduces parts of this framework as JavaScript classes in Electron, with the eventual goal of allowing developers to create non-web UI elements to their Electron applications. This will prevent apps from having to hack together web contents.
使这一新套API成为可能的基础工作目前正在进行中。以下是你在不久的将来可以期待的一些首批功能。
🌐 The groundwork to make this new set of APIs possible is currently in progress. Here are a few of the first things you can expect in the near future.
示例:使用 WebContentsView 重构窗口模型
🌐 Example: Refactoring the window model with WebContentsView
我们计划的第一个变更是将 Chrome 的 WebContentsView 暴露给 Electron 的 API 接口,它将成为我们现有 BrowserView API 的继任者(尽管名称如此,但 BrowserView 是 Electron 特有的代码,与 Chromium Views 无关)。通过暴露 WebContentsView,我们将拥有一个可重用的 View 对象来显示网页内容,这为将 BrowserWindow 类完全转为 JavaScript 并进一步减少代码复杂性打开了大门。
🌐 Our first planned change is to expose Chrome’s WebContentsView to Electron’s API surface, which will be the successor to our existing BrowserView API (which, despite the name, is Electron-specific code unrelated to Chromium Views). With WebContentsView exposed, we will have a reusable View object that can display web contents, opening the door to making the BrowserWindow class pure JavaScript and eliminating even more code complexity.
虽然这一变化并没有为应用开发者提供大量新的功能,但它是一次大规模重构,消除了大量底层代码,简化了 Chromium 的升级,并减少了在主要版本之间出现新错误的风险。
🌐 Although this change doesn’t provide a lot of new functionality to app developers, it is a large refactor that eliminates a lot of code under the hood, simplifying Chromium upgrades and reducing the risk of new bugs appearing between major versions.
如果你是一个在应用中使用 BrowserViews 的 Electron 开发者:别担心,我们没有忘记你!我们计划将现有的 BrowserView 类作为 WebContentsView 的一个兼容层,以在你过渡到更新的 API 时提供缓冲。
🌐 If you’re an Electron developer using BrowserViews in your app: don’t worry, we haven’t forgotten about you! We plan on making the existing BrowserView class a shim for WebContentsView to provide a buffer as you transition to the newer APIs.
参见:electron/electron#35658
🌐 See: electron/electron#35658
示例:带有 ScrollView 的可滚动网页内容
🌐 Example: Scrollable web contents with ScrollView
我们在 Stack 的朋友一直在推动一项计划,将 Chromium 的 ScrollView 组件暴露给 Electron 的 API。通过这个新 API,任何子 View 组件都可以设置为水平或垂直滚动。
🌐 Our friends at Stack have been driving an initiative to expose the Chromium ScrollView component to Electron’s API. With this new API, any child View component can be made scrollable horizontally or vertically.
虽然这个新的 API 仅实现了一个较小的功能,但团队最终的目标是构建一套实用的视图组件,这些组件可以作为工具包用于构建更复杂的非 HTML 界面。
🌐 Although this new API fulfills a single smaller functionality, the team’s eventual goal is to build a set of utility View components that can be used as a toolkit to build more complex non-HTML interfaces.
参与其中
🌐 Getting involved
你是一名对这些 API 提案感兴趣的 Electron 应用开发者吗?虽然我们还没有准备好接收更多的 RFC,请继续关注未来的更多细节!
🌐 Are you an Electron app developer interested in either of these API proposals? Although we’re not quite ready to receive additional RFCs, please stay tuned for more details in the future!
Electron Forge v6 稳定版
🌐 Electron Forge v6 stable release
自从该框架诞生以来,Electron 的构建工具生态系统主要由社区驱动,由许多小型、单一功能的包组成(例如 electron-winstaller、electron-packager、electron-notarize、electron-osx-sign)。虽然这些工具运作良好,但对于用户来说,要拼凑出一个可用的构建进程仍然令人望而生畏。
🌐 Since the framework’s inception, Electron’s build tooling ecosystem has been largely community-driven and has consisted of many small single-purpose packages (e.g. electron-winstaller, electron-packager, electron-notarize, electron-osx-sign). Although these tools work well, it’s intimidating for users to piece together a working build pipeline.
为了帮助为 Electron 开发者打造一个更友好的体验,我们创建了 Electron Forge,这是一种一体化解决方案,将所有现有的工具整合到一个界面中。虽然 Forge 自 2017 年起就开始开发,但在过去几年中该项目一直处于休眠状态。然而,鉴于社区对 Electron 构建工具现状的反馈,我们一直在努力发布下一代稳定的 Forge 主要版本。
🌐 To help build a friendlier experience for Electron developers, we built Electron Forge, an all-in-one solution that combines all this existing tooling into a single interface. Although Forge has been in development since 2017, the project has lain dormant for the last few years. However, given community feedback on the state of build tooling in Electron, we have been hard at work on releasing the next-gen stable major version of Forge.
Electron Forge 6 提供一流的 TypeScript 和 Webpack 支持,同时还具有可扩展的 API,允许开发者创建自己的插件和安装程序。
🌐 Electron Forge 6 comes with first-class TypeScript and Webpack support, as well as an extensible API that allows developers to create their own plugins and installers.
敬请关注:公告即将发布
🌐 Stay tuned: announcement coming soon
如果你有兴趣使用 Forge 构建项目,或者使用 Forge 可扩展的第三方 API 构建模板或插件,请继续关注我们关于 Forge v6 稳定版本的官方公告,预计将在本月发布!
🌐 If you’re interested in building a project with Forge or building templates or plugins with Forge’s extensible third-party APIs, stay tuned for our official announcement on the Forge v6 stable release sometime this month!
下一步是什么?
🌐 What’s next?
除了上述内容之外,团队还一直在考虑一系列探索性项目,以改善 Electron 给应用开发者和终端用户的体验。我们也在尝试更新工具、API 审查进程以及增强文档等其他方面的改进。我们希望在不久的将来能分享更多消息!
🌐 Aside from the above, the team is always thinking of a bunch of exploratory projects to make the Electron experience better for app developers and end users. Updater tooling, API review processes, and enhanced documentation are other things we are experimenting with. We hope to have more news to share in the near future!