Skip to main content

谷歌文档季

· 5 min read

Electron 很荣幸能够参与 Google 第二届“文档季”计划,该计划将来自开源组织的导师与技术文档撰写者配对,以改进项目文档。

🌐 Electron is proud to be participating in the second edition of Google's Season of Docs initiative, which pairs mentors from open source organizations with technical writers to improve project documentation.


什么是 Season of Docs?

🌐 What is Season of Docs?

Season of Docs logo

Season of Docs 是一个促进技术文档撰写者与开源社区之间协作的项目,旨在让双方受益。开源维护者利用文档撰写者的技术写作专长来改进其文档的结构和内容,而技术文档撰写者则在导师的指导下加入开源社区。你可以在 Google 的 Season of Docs 网站 上了解更多信息。

🌐 Season of Docs is a program that fosters collaboration between technical writers and open source communities to the benefit of both parties. Open source maintainers utilize the writer's technical writing expertise to improve the structure and content of their documentation, while the technical writer is introduced to an open-source community under the guidance of its mentors. Learn more about it on the Google's Season of Docs website.

这是我们首次参与该计划,我们将指导一名技术写作人员,他将与 Electron 的 Ecosystem Working Group 一起工作,重塑我们文档的大部分内容。你可以在这里了解整个项目的时间表 here

🌐 For our first time participating in the program, we'll be mentoring a single technical writer who will be working alongside Electron's Ecosystem Working Group to reshape large parts of our documentation. You can learn more about the timeline of the whole project here.

如何注册?

🌐 How do I sign up?

你有兴趣作为技术写作与我们合作吗?首先,请先了解谷歌今年项目的技术写作指南,并查看我们准备的两个项目创意草稿

🌐 Are you interested in collaborating with us as a technical writer? First, get familiar with Google's tech writer guide for this year's program, and check out the two project idea drafts that we have prepared.

想要被选为 Electron 文档季的技术作家,候选人需要在 6 月 8 日至 7 月 9 日的技术作家申请阶段,在 Google 文档季网站上提交申请。

🌐 In order to be selected as Electron's technical writer for Season of Docs, candidates will need to apply on the Google Season of Docs website during the Technical Writer Application phase that is running from June 8 to July 9..

你的申请应包括一份提案,这是一份书面文件,详细描述你计划在三个月内在 Electron 文档上实现的内容。这份提案可以基于我们的项目创意文档中提到的某个起始点,也可以是全新的内容。不知道从哪里开始?你可以查看去年的被接受提案名单以获得灵感。

🌐 Your application should include a proposal, which is a written document that describes in detail what you plan to achieve on the Electron docs over the course of 3 months. This proposal can either develop on one of the starting points mentioned in our Project Idea doc, or can be something entirely new. Don't know where to start? You can check out last year's list of accepted proposals for inspiration.

除了提案之外,我们还会审查你作为技术写作人员的背景。请附上你的简历,重点突出相关的写作经验,同时提供技术写作样本(这些样本可以是现有文档、教程、博客文章等)。

🌐 Aside from the proposal, we'll also be looking at your background as a technical writer. Please include a copy of your resume with an emphasis on relevant writing experience, as well as technical writing samples (these samples could be existing documentation, tutorial, blog posts, etc.)

如果你想讨论项目提案,给我们发邮件至 season-of-docs@electronjs.org,我们可以从那里开始交流!

🌐 If you want to discuss project proposals, shoot us an email at season-of-docs@electronjs.org and we can chat from there!

参考

🌐 References

Electron 2.0 及以后的语义化版本

· 2 min read

Electron 正在开发一个新的主要版本,同时我们对版本控制策略也进行了一些调整。从 2.0.0 版本开始,Electron 将严格遵循语义化版本控制(Semantic Versioning)。

🌐 A new major version of Electron is in the works, and with it some changes to our versioning strategy. As of version 2.0.0, Electron will strictly adhere to Semantic Versioning.


这一变化意味着你会更频繁地看到主版本的提升,而且通常会是对 Chromium 的重大更新。补丁版本也将更加稳定,因为它们现在只包含错误修复,不会有新功能。

🌐 This change means you'll see the major version bump more often, and it will usually be a major update to Chromium. Patch releases will also be more stable, as they will now only contain bug fixes with no new features.

主要版本更新

  • Chrom 版本更新
  • Node.js 主要版本更新
  • Electron 断裂 API 更改

次要版本更新

  • Node.js 小版本更新
  • Electron 不间断 API 更改

补丁版本递增

  • Node.js 补丁版本更新
  • 修复相关的 chromium 补丁
  • Electron 错误修复

因为 Electron 的 semver 范围现在将更有意义,我们建议使用 npm 的默认 --save-dev 标志来安装 Electron,这将为你的版本加上 ^ 前缀,使你能够安全地保持次要和修补程序更新:

🌐 Because Electron's semver ranges will now be more meaningful, we recommend installing Electron using npm's default --save-dev flag, which will prefix your version with ^, keeping you safely up to date with minor and patch updates:

npm install --save-dev electron

对于只对错误修复感兴趣的开发者,你应该使用波浪号语义版本前缀,例如 ~2.0.0,它不会引入新功能,只会进行修复以提高稳定性。

🌐 For developers interested only in bug fixes, you should use the tilde semver prefix e.g. ~2.0.0, which which will never introduce new features, only fixes to improve stability.

欲了解更多详情,请参见 electronjs.org/docs/tutorial/electron-versioning

🌐 For more details, see electronjs.org/docs/tutorial/electron-versioning.

Electron 40.0.0

· 6 min read

Electron 40.0.0 已发布!它包括对 Chromium 144.0.7559.60、V8 14.4 和 Node 24.11.1 的升级。

🌐 Electron 40.0.0 has been released! It includes upgrades to Chromium 144.0.7559.60, V8 14.4, and Node 24.11.1.


Electron 团队很高兴地宣布发布 Electron 40.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 40.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

技术讲座:改善窗口调整大小的行为

· 26 min read

我们将推出一个新的博客文章系列,分享我们在 Electron 上工作的点滴。如果你对这项工作感兴趣,请考虑贡献

🌐 We're launching a new blog post series where we share glimpses into our work on Electron. If you find this work interesting, please consider contributing!


最近,我在改进 Electron 和 Chromium 的窗口调整大小行为。

🌐 Recently, I worked on improving Electron and Chromium's window resize behavior.

这个虫子

🌐 The bug

我们在 Windows 上遇到了一个问题,在调整窗口大小时旧的帧会变得可见:

🌐 We were seeing an issue on Windows where old frames would become visible while resizing a window:

Animated GIF showing the issue where old frames would be shown while resizing windows

是什么让这个漏洞特别有趣?

🌐 What made this bug particularly interesting?

  1. 很有挑战性。
  2. 它位于一个大型代码库的深处。
  3. 正如你稍后会看到的,系统内部其实有两个不同的漏洞。

修复错误

🌐 Fixing the bug

遇到这样的漏洞,首先的挑战是确定从哪里开始调查。

🌐 With a bug like this, the first challenge is figuring out where to start looking.

Electron 构建在 Chromium 之上,Chromium 是 Google Chrome 的开源版本。在编译 Electron 时,Electron 的源代码会作为子目录添加到 Chromium 的源代码树中。然后,Electron 依赖 Chromium 的代码来提供现代浏览器的大部分功能。

🌐 Electron builds upon Chromium, the open source version of Google Chrome. When compiling Electron, Electron's source code is added into the Chromium source tree as a subdirectory. Electron then relies on Chromium's code to provide most of the functionality of a modern browser.

Chromium 大约有 3600 万行代码。Electron 也是一个大型项目。这有很多代码可能会导致这个问题。

🌐 Chromium has about 36 million lines of code. Electron is a large project, too. That is a lot of code that could be causing this issue.

十二月的宁静月(2025年12月)

· 5 min read

从12月1日起,Electron 项目将进入一个静默期,并将在2026年1月恢复全面运作。有关详细信息,请参见下方的政策部分。

🌐 Starting December 1, the Electron project will enter a quiet period before picking back up at full capacity in January 2026. For full details, see the Policies section below.

自2020年以来,十二月一直是项目维护者从日常维护工作中喘息一下的时期,以便剩余或专注于深入工作。这段剩余有助于我们恢复精力,为即将到来的一年充满活力地回归。

🌐 Since 2020, December has been a time for project maintainers to take a breather from regular maintenance duties in order to take a break or focus on heads-down work. This break helps us rest up and come back energized for the year to come.

也就是说,像这样为期一个月的暂停只有在开源项目处于健康状态时才能实现——我们要感谢所有维护者和外部贡献者,感谢你们持续不断的努力,推动项目不断前进。❤️

🌐 That said, a month-long pause like this one is only achievable when an open-source project is in a healthy state—we’d like to thank all maintainers and external contributors for all of their continued efforts to keep the project moving. ❤️

Electron 39.0.0

· 8 min read

Electron 39.0.0 已发布!它包括对 Chromium 142.0.7444.52、V8 14.2 和 Node 22.20.0 的升级。

🌐 Electron 39.0.0 has been released! It includes upgrades to Chromium 142.0.7444.52, V8 14.2, and Node 22.20.0.


Electron 团队很高兴地宣布发布 Electron 39.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 39.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

🌐 Notable Changes

ASAR 完整性升级为稳定版

🌐 ASAR Integrity graduates to stable

一个长期存在的“实验性”功能——ASAR 完整性——现在在 Electron 39 中变得稳定。当你启用此功能时,它会在运行时将你打包的 app.asar 与构建时的哈希值进行验证,以检测是否有任何篡改。如果没有哈希值或哈希值不匹配,应用将被强制终止。

🌐 A long-standing "experimental" feature -- ASAR integrity -- is now stable in Electron 39. When you enable this feature, it validates your packaged app.asar at runtime against a build-time hash to detect any tampering. If no hash is present or if there is a mismatch in the hashes, the app will forcefully terminate.

请参阅 ASAR 完整性文档 以获取有关该功能的完整信息,包括功能的工作原理、如何在应用中使用它,以及如何在 Electron Forge 和 Electron Packager 中使用它。

🌐 See the ASAR integrity documentation for full information on how on the feature works, on how to use it in your application, and how to use it in Electron Forge and Electron Packager.

相关新闻,Electron Packager v19 现在默认启用 ASAR。#1841

🌐 In related news, Electron Packager v19 now enables ASAR by default. #1841

Electron 38.0.0

· 7 min read

Electron 38.0.0 已发布!它包括对 Chromium 140.0.7339.41、V8 14.0 和 Node 22.16.0 的升级。

🌐 Electron 38.0.0 has been released! It includes upgrades to Chromium 140.0.7339.41, V8 14.0, and Node 22.16.0.


Electron 团队很高兴地宣布发布 Electron 38.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 38.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

Electron 37.0.0

· 10 min read

Electron 37.0.0 已发布!它包括对 Chromium 138、V8 13.8 和 Node 22.16.0 的升级。

🌐 Electron 37.0.0 has been released! It includes upgrades to Chromium 138, V8 13.8, and Node 22.16.0.


Electron 团队很高兴地宣布发布 Electron 37.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 37.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

Google Summer of Code 开始

🌐 Google Summer of Code Begins

我们两位 Google Summer of Code 贡献者已经开始了该项目的编码阶段!

🌐 Our two Google Summer of Code contributors have started the program's coding period!

  • @nilayarya 正在 Electron 核心中开发一个新的 保存/恢复窗口状态 API。新的 API 将提供一种内置的、标准化的方式来处理窗口状态的持久化。详见 Nilay 正在进行中的 RFC:electron/rfcs#16
  • @hitarth-gg 正在努力使用 Chrome Manifest V3 API 现代化长期未活跃的 Devtron 扩展。该项目将为开发者提供工具,以调试 IPC 通信、跟踪事件监听器,并可视化他们的 Electron 应用中的模块依赖。

对于我们的 GSOC 参与者来说,这几周是令人兴奋的,敬请期待更多更新!

🌐 It has been an exciting couple of weeks for our GSOC participants, so stay tuned for more updates!

显著变化

🌐 Notable Changes

圆角平滑:原生 CSS Squircle

🌐 Smooth Corners: Native CSS Squircles

An image showing different corner smoothing values (0%, 30%, 60%, and 100%) applied to rectangles, with 60% labeled as matching macOS style

Electron 37 引入了自定义 -electron-corner-smoothing CSS 属性,这使应用能够创建更平滑的圆角,以匹配苹果 macOS 的设计风格。这个功能最初是在 Electron 36 中推出的,但我们觉得它值得获得更多关注。

🌐 Electron 37 introduces the custom -electron-corner-smoothing CSS property, which allows apps to create smoother rounded corners to match Apple's macOS design language. This feature originally landed in Electron 36, but we felt like it deserved a brighter spotlight.

100% 圆角平滑示例

代码结果
.box {
width: 128px;
height: 128px;
border-radius: 24px;
-electron-corner-smoothing: 100%;
}

与标准的 border-radius 属性不同,它会从矩形上切出四分之一圆角,-electron-corner-smoothing 会将曲线平滑地过渡为具有连续周长的 方形圆 形状。

🌐 Unlike the standard border-radius property, which carves quarter-circle corners out of a rectangle, -electron-corner-smoothing smoothly transitions the curve into a squircle shape with a continuous perimeter.

你可以使用 0% 到 100% 的数值来调整平滑度,或者使用 system-ui 值以匹配操作系统的风格(macOS 上为 60%,其他系统为 0%)。 这一设计增强可以应用于边框、轮廓和阴影,为你的应用增添一层细腻的精致感。

🌐 You can adjust the smoothness using values from 0% to 100%, or use the system-ui value to match the operating system's style (60% on macOS and 0% otherwise). This design enhancement can be applied on borders, outlines, and shadows, giving your app a subtle layer of polish.

tip

阅读更多关于 Electron 中 squircles 实现的信息,请参见 @clavinRFC 0012。 该文档更详细地介绍了动机和技术实现。

初始设计灵感来自 Figma 的圆角平滑实现。想了解他们为实现圆角平滑所做的探索,请阅读 《拼命寻找 squircles》

Electron 36.0.0

· 8 min read

Electron 36.0.0 已发布!它包括对 Chromium 136、V8 13.6 和 Node 22.14.0 的升级。

🌐 Electron 36.0.0 has been released! It includes upgrades to Chromium 136, V8 13.6, and Node 22.14.0.


Electron 团队很高兴地宣布发布 Electron 36.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 36.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

🌐 Notable Changes

写作工具支持

🌐 Writing Tools Support

在 Electron 36 中,你可以在上下文菜单中启用 macOS 系统级功能,例如写作工具(拼写和语法检查)、自动填充以及服务菜单项。要实现此功能,请将一个 WebFrameMain 实例传入 menu.popup()frame 参数中。

🌐 In Electron 36, you can enable macOS system-level features like Writing Tools (spelling and grammar), Autofill, and Services menu items in your context menus. To do so, pass a WebFrameMain instance into the frame parameter for menu.popup().

import { BrowserWindow, Menu, WebFrameMain } from 'electron';

const currentWindow = BrowserWindow.getFocusedWindow();
const focusedFrame = currentWindow.webContents.focusedFrame;
const menu = Menu.buildFromTemplate([{ label: 'Copy', role: 'copy' }]);

menu.popup({
window: currentWindow,
frame: focusedFrame,
});

Electron 35.0.0

· 10 min read

Electron 35.0.0 已发布!它包括对 Chromium 134.0.6998.44、V8 13.5 和 Node 22.14.0 的升级。

🌐 Electron 35.0.0 has been released! It includes upgrades to Chromium 134.0.6998.44, V8 13.5, and Node 22.14.0.


Electron 团队很高兴地宣布发布 Electron 35.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 35.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请通过 BlueskyMastodon 与我们分享,或者加入我们的社区 Discord!可以在 Electron 的 问题追踪器 报告漏洞和功能请求。

🌐 If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

🌐 Notable Changes

Service Worker 预加载脚本,用于改进扩展支持

🌐 Service Worker Preload Scripts for Improved Extensions Support

最初由 @samuelmaddockRFC #8 中提出,Electron 35 增加了向 服务工作者 附加预加载脚本的能力。随着 Chrome 的 Manifest V3 扩展将大量工作通过 扩展服务工作者 路由,这一功能填补了 Electron 对现代 Chrome 扩展支持的空白。

🌐 Originally proposed in RFC #8 by @samuelmaddock, Electron 35 adds the ability to attach a preload script to Service Workers. With Chrome's Manifest V3 Extensions routing a lot of work through extension service workers, this feature fills in a gap in Electron's support for modern Chrome extensions.

在会话级别以编程方式注册预加载脚本时,现在可以使用 ses.registerPreloadScript(script) API 将其专门应用于服务工作线程上下文。

🌐 When registering a preload script programmatically at the Session level, you can now specifically apply it to Service Worker contexts with the ses.registerPreloadScript(script) API.

Main Process
// Add our preload realm script to the session.
session.defaultSession.registerPreloadScript({
// Our script should only run in service worker preload realms.
type: 'service-worker',
// The absolute path to the script.
script: path.join(__dirname, 'extension-sw-preload.js'),
});

此外,现在可以通过 ServiceWorkerMain.ipc 类在 Service Workers 与其附加的预加载脚本之间进行 IPC。预加载脚本仍将使用 ipcRenderer 模块与其 Service Worker 通信。更多详细信息请参阅原始 RFC。

🌐 Furthermore, IPC is now available between Service Workers and their attached preload scripts via the ServiceWorkerMain.ipc class. The preload script will still use the ipcRenderer module to communicate with its Service Worker. See the original RFC for more details.

此功能之前有许多其他更改为其奠定了基础:

🌐 This feature was preceded by many other changes that laid the groundwork for it:

  • #45329 重新设计了 Session 模块的预加载 API,以支持注册和注销单个预加载脚本。
  • #45229 添加了实验性的 contextBridge.executeInMainWorld(executionScript) 脚本,用于通过上下文桥在主世界中评估 JavaScript。
  • #45341 在主进程中添加了 ServiceWorkerMain 类以与服务工作者进行交互。