Skip to main content

Electron 36.0.0

· 9 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 install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥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 系统级功能,例如写作工具(拼写和语法)、自动填充和服务菜单项。为此,请将 Web 框架主 实例传递给 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,
});

技术栈变更

¥Stack Changes

Electron 36 将 Chromium 从 134.0.6998.23 升级到 136.0.7103.48,并将 V8 从 13.5 升级到 13.6

¥Electron 36 upgrades Chromium from 134.0.6998.23 to 136.0.7103.48, and V8 from 13.5 to 13.6.

新功能和改进

¥New Features and Improvements

  • 添加 BrowserWindow.isSnapped() 以指示给定窗口是否已通过 Windows 上的 Snap 排列。#46226

    ¥Added BrowserWindow.isSnapped() to indicate whether a given window has been arranged via Snap on Windows. #46226

  • 添加 WebContents.focusedFrame 以获取焦点框架。

    ¥Added WebContents.focusedFrame to get the focused frame.

  • 修复了 WebContents.opener 以指定潜在的 null 类型。#45667

    ¥Fixed WebContents.opener to specify potential null type. #45667

  • 添加 ffmpeg.dll 以延迟加载配置。#461733435 中也支持)

    ¥Added ffmpeg.dll to delay load configuration. #46173 (Also in 34, 35)

  • 添加 nativeTheme.shouldUseDarkColorsForSystemIntegratedUI 以区分系统主题和应用主题。#4659835 中也包含)

    ¥Added nativeTheme.shouldUseDarkColorsForSystemIntegratedUI to distinguish system and app theme. #46598 (Also in 35)

  • webRequest 过滤器中添加了 excludeUrls,并弃用了 urls 属性中空数组的使用。#4469235 中也包含)

    ¥Added excludeUrls to webRequest filter and deprecated the use of empty arrays in urls property. #44692 (Also in 35)

  • 通过 menu.popup 中新的 frame 选项,在上下文菜单中添加了对自动填充、写作工具和服务 macOS 级菜单项的支持。#46350

    ¥Added support for Autofill, Writing Tools and Services macOS level menu items in context menus via the new frame option in menu.popup. #46350

  • 添加了对 Linux 上 system-context-menu 的支持。#46399

    ¥Added support for system-context-menu on Linux. #46399

  • 改进了 Windows 上的 ASAR 完整性检查。#46537

    ¥Improved ASAR integrity checks on Windows. #46537

  • 改进了在 macOS 上不请求缩略图时 desktopCapturer.getSources 的性能。#462513435 中也支持)

    ¥Improved performance of desktopCapturer.getSources when not requesting thumbnails on macOS. #46251 (Also in 34, 35)

  • 移除了使用共享纹理 OSR 时 240 FPS 的限制。#4566935 中也存在)

    ¥Removed 240 FPS limit when use shared texture OSR. #45669 (Also in 35)

重大变化

¥Breaking Changes

已弃用:NativeImage.getBitmap()

¥Deprecated: NativeImage.getBitmap()

NativeImage.getBitmap() 函数现已弃用,并记录为 NativeImage.toBitmap() 的别名。这两个函数都返回一个新分配的位图副本,并且功能相同。

¥The NativeImage.getBitmap() function is now deprecated and documented as an alias for NativeImage.toBitmap(). The two functions both return a newly-allocated copy of the bitmap and are functionally equivalent.

已弃用:session 上的扩展方法和事件

¥Deprecated: Extension methods and events on session

session.loadExtensionsession.removeExtensionsession.getExtensionsession.getAllExtensions 以及事件 extension-loadedextension-unloadedextension-ready 均已移至新的 Extensions 对象,可通过 session.extensions 实例属性访问。

¥session.loadExtension, session.removeExtension, session.getExtension, session.getAllExtensions, and the events extension-loaded, extension-unloaded, and extension-ready have all moved to the new Extensions object accessible via the session.extensions instance property.

删除:session.clearStorageData(options) 中的 quota 类型 syncable

¥Removed: quota type syncable in session.clearStorageData(options)

调用 session.clearStorageData(options) 时,options.quota 类型 syncable 不再受支持,因为它已从上游 Chromium 升级为 removed

¥When calling session.clearStorageData(options), the options.quota type syncable is no longer supported because it has been removed from upstream Chromium.

已弃用:session.clearStorageData(options) 中的 quota 属性

¥Deprecated: quota property in session.clearStorageData(options)

调用 Session.clearStorageData(options) 时,options.quota 属性已被弃用。由于 syncable 类型已被删除,只剩下 'temporary' 类型,因此无需指定。

¥When calling Session.clearStorageData(options), the options.quota property is deprecated. Since the syncable type was removed, there is only type left -- 'temporary' -- so specifying it is unnecessary.

行为改变:在 GNOME 上运行时,GTK 4 是默认设置

¥Behavior Changed: GTK 4 is the default when running on GNOME

上游变更 之后,GTK 4 现在是 GNOME 运行时的默认设置。

¥After an upstream change, GTK 4 is now the default when running on GNOME.

在极少数情况下,这可能会导致某些应用或配置发生 error 错误,并显示以下消息:

¥In rare cases, this may cause some applications or configurations to error with the following message:

Gtk-ERROR **: 11:30:38.382: GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported

受影响的用户可以通过指定 gtk-version 命令行标志来解决这个问题:

¥Affected users can work around this by specifying the gtk-version command-line flag:

$ electron --gtk-version=3   # or --gtk-version=2

app.commandLine.appendSwitch 函数也可以实现同样的功能。

¥The same can be done with the app.commandLine.appendSwitch function.

行为改变:app.commandLine

¥Behavior Changed: app.commandLine

app.commandLine 会将大写的开关和参数转换为小写。

¥app.commandLine will convert uppercases switches and arguments to lowercase.

app.commandLine 仅用于处理 Chromium 开关(不区分大小写),通过 app.commandLine 传递的开关不会传递给任何子进程。

¥app.commandLine was only meant to handle Chromium switches (which aren't case-sensitive) and switches passed via app.commandLine will not be passed down to any of the child processes.

如果你使用 app.commandLine 解析特定于应用的命令行参数,则应通过 process.argv 执行此操作。

¥If you were using app.commandLine to parse app-specific command line arguments, you should do this via process.argv.

33.x.y 停止支持

¥End of Support for 33.x.y

Electron 33.x.y 已根据项目的 支持政策 达到支持终止状态。建议开发者和应用升级到较新版本的 Electron。

¥Electron 33.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E36 (2025 年 4 月)E37 (2025 年 6 月)E38 (2025 年 8 月)
36.x.y37.x.y38.x.y
35.x.y36.x.y37.x.y
34.x.y35.x.y36.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.