Electron 30.0.0
Electron 30.0.0 已发布!它包括对 Chromium 124.0.6367.49、V8 12.4 和 Node.js 20.11.1 的升级。
🌐 Electron 30.0.0 has been released! It includes upgrades to Chromium 124.0.6367.49, V8 12.4, and Node.js 20.11.1.
Electron 团队很高兴地宣布发布 Electron 30.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。
🌐 The Electron team is excited to announce the release of Electron 30.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.
如果你有任何反馈,请通过 Twitter 或 Mastodon 与我们分享,或者加入我们的社区 Discord!错误和功能请求可以在 Electron 的 问题追踪器 中报告。
🌐 If you have any feedback, please share it with us on Twitter or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.
显著变化
🌐 Notable Changes
- 现在在 Windows 上支持 ASAR 完整性保险丝 (#40504)
- 如果配置不正确,启用 ASAR 完整性的现有应用可能无法在 Windows 上运行。使用 Electron 打包工具的应用应升级到
@electron/packager@18.3.1或@electron/forge@7.4.0。 - 查看我们的 ASAR 完整性教程 了解更多信息。
- 如果配置不正确,启用 ASAR 完整性的现有应用可能无法在 Windows 上运行。使用 Electron 打包工具的应用应升级到
- 已添加
WebContentsView和BaseWindow主进程模块,弃用并替换BrowserView(#35658)。了解更多关于如何从BrowserView迁移到WebContentsView的信息,请参阅 这篇博客文章。BrowserView现在是WebContentsView的一个封装层,旧的实现已被移除。- 请参阅我们的网页嵌入文档,了解新的
WebContentsViewAPI 与其他类似 API 的比较。
- 已实现对 文件系统 API 的支持 (#41827)
技术栈变更
🌐 Stack Changes
- Chromium
124.0.6367.49- 在 Chrome 124 和 DevTools 124 中的新功能
- 在 Chrome 123 和 DevTools 123 中的新功能
- 节点
20.11.1 - V8
12.4
Electron 30 将 Chromium 从 122.0.6261.39 升级到 124.0.6367.49,Node 从 20.9.0 升级到 20.11.1,V8 从 12.2 升级到 12.4。
🌐 Electron 30 upgrades Chromium from 122.0.6261.39 to 124.0.6367.49, Node from 20.9.0 to 20.11.1, and V8 from 12.2 to 12.4.
新功能
🌐 New Features
- 向 webviews 添加了
transparent网络偏好设置。(#40301) - 在 webContents API 上添加了一个新的实例属性
navigationHistory,并提供了navigationHistory.getEntryAtIndex方法,使应用能够获取浏览历史中任何导航条目的 URL 和标题。 (#41662) - 新增了
BrowserWindow.isOccluded()方法,允许应用检查遮挡状态。(#38982) - 为从实用程序进程使用
net模块发出的请求添加了代理配置支持。(#41417) - 在
navigator.serial中添加了对通过服务类 ID 请求的蓝牙端口的支持。(#41734) - 新增对 Node.js
NODE_EXTRA_CA_CERTSCLI 标志的支持。(#41822)
重大变化
🌐 Breaking Changes
行为更改:跨源 iframe 现在使用权限策略访问功能
🌐 Behavior Changed: cross-origin iframes now use Permission Policy to access features
跨来源的 iframe 现在必须通过 allow 属性指定特定 iframe 可用的功能,才能访问这些功能。
🌐 Cross-origin iframes must now specify features available to a given iframe via the allow
attribute in order to access them.
有关更多信息,请参见文档。
🌐 See documentation for more information.
已移除:--disable-color-correct-rendering 命令行开关
🌐 Removed: The --disable-color-correct-rendering command line switch
这个开关从未被正式记录,但无论如何,这里仍记录了它的删除情况。Chromium 本身现在对色彩空间有更好的支持,因此不再需要这个标志。
🌐 This switch was never formally documented but its removal is being noted here regardless. Chromium itself now has better support for color spaces so this flag should not be needed.
行为已改变:macOS 上的 BrowserView.setAutoResize 行为
🌐 Behavior Changed: BrowserView.setAutoResize behavior on macOS
在 Electron 30 中,BrowserView 现在是新的 WebContentsView API 的一个封装。
🌐 In Electron 30, BrowserView is now a wrapper around the new WebContentsView API.
之前,BrowserView API 的 setAutoResize 函数在 macOS 上依赖于 自动调整大小,而在 Windows 和 Linux 上则使用自定义算法。
对于一些简单的用例,例如让 BrowserView 填满整个窗口,这两种方法的行为是相同的。
然而,在更复杂的情况下,BrowserView 在 macOS 上的自动调整大小行为会与其他平台不同,因为 Windows 和 Linux 的自定义调整算法并不能完美匹配 macOS 自动调整大小 API 的行为。
现在,自动调整大小的行为已在所有平台上统一。
🌐 Previously, the setAutoResize function of the BrowserView API was backed by autoresizing on macOS, and by a custom algorithm on Windows and Linux.
For simple use cases such as making a BrowserView fill the entire window, the behavior of these two approaches was identical.
However, in more advanced cases, BrowserViews would be autoresized differently on macOS than they would be on other platforms, as the custom resizing algorithm for Windows and Linux did not perfectly match the behavior of macOS's autoresizing API.
The autoresizing behavior is now standardized across all platforms.
如果你的应用使用 BrowserView.setAutoResize 来执行比让 BrowserView 填充整个窗口更复杂的操作,那么你很可能已经有自定义逻辑来处理 macOS 上这种行为的差异。
如果是这样,那么在 Electron 30 中就不再需要这些逻辑,因为自动调整大小的行为是一致的。
🌐 If your app uses BrowserView.setAutoResize to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS.
If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.
已移除:WebContents 上 context-menu 的 params.inputFormType 属性
🌐 Removed: params.inputFormType property on context-menu on WebContents
WebContents 的 context-menu 事件中 params 对象的 inputFormType 属性已被移除。请改用新的 formControlType 属性。
🌐 The inputFormType property of the params object in the context-menu
event from WebContents has been removed. Use the new formControlType
property instead.
已移除:process.getIOCounters()
🌐 Removed: process.getIOCounters()
Chromium 已删除对此信息的访问。
🌐 Chromium has removed access to this information.
27.x.y 支持终止
🌐 End of Support for 27.x.y
根据项目的支持政策,Electron 27.x.y 已达到支持终止。建议开发者和应用升级到更新版本的 Electron。
🌐 Electron 27.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.
| E30(2024年4月) | E31(2024年6月) | E32(2024年8月) |
|---|---|---|
| 30.x.y | 31.x.y | 32.x.y |
| 29.x.y | 30.x.y | 31.x.y |
| 28.x.y | 29.x.y | 30.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.