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.

Group Photo! Taken by @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 应用创建非 Web 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(尽管名称如此,但它是 Electron 特有的代码,与 Chromium Views 无关)。随着 WebContentsView 的公开,我们将拥有一个可重用的 View 对象,它可以显示 Web 内容,从而为将 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 升级,并降低主要版本之间出现新 bug 的风险。
¥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.
如果你是 Electron 开发者,并在应用中使用 BrowserViews:别担心,我们没有忘记你!我们计划将现有的 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,任何子视图组件都可以水平或垂直滚动。
¥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 仅实现了一个较小的功能,但团队的最终目标是构建一组实用的 View 组件,可用作构建更复杂的非 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
你是一位 Electron 应用开发者,对这两个 API 提案感兴趣吗?虽然我们尚未准备好接收更多 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!