Electron 29.0.0
Electron 29.0.0 已发布!它包括对 Chromium 122.0.6261.39、V8 12.2 和 Node.js 20.9.0 的升级。
🌐 Electron 29.0.0 has been released! It includes upgrades to Chromium 122.0.6261.39, V8 12.2, and Node.js 20.9.0.
Electron 团队很高兴地宣布发布 Electron 29.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。
🌐 The Electron team is excited to announce the release of Electron 29.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
- 新增了一个顶层
webUtils模块,这是一个渲染进程模块,提供了与 Web API 对象交互的实用层。模块中第一个可用的 API 是webUtils.getPathForFile。Electron 之前的File.path扩展偏离了 Web 标准;这个新 API 更符合当前的 Web 标准行为。
技术栈变更
🌐 Stack Changes
- Chromium
122.0.6261.39- 在 Chrome 122 和 DevTools 122 中的新功能
- 在 Chrome 121 和 DevTools 121 中的新功能
- 节点
20.9.0 - V8
12.2
Electron 29 将 Chromium 从 120.0.6099.56 升级到 122.0.6261.39,Node 从 18.18.2 升级到 20.9.0,V8 从 12.0 升级到 12.2。
🌐 Electron 29 upgrades Chromium from 120.0.6099.56 to 122.0.6261.39, Node from 18.18.2 to 20.9.0, and V8 from 12.0 to 12.2.
新功能
🌐 New Features
- 添加了新的
webUtils模块,这是一个用于与 Web API 对象交互的实用层,用于替换File.path扩展。#38776 - 已将 net 模块添加到 实用程序进程。 #40890
- 添加了一个新的 Electron Fuse
grantFileProtocolExtraPrivileges,它使file://协议采用更安全、更严格的行为,从而与 Chromium 保持一致。#40372 - 在
protocol.registerSchemesAsPrivileged中添加了一个选项,以允许在自定义方案中使用 V8 代码缓存。#40544 - 将
app.{set|get}LoginItemSettings(settings)迁移至在 macOS 13.0 及以上版本上使用苹果新推荐的底层框架。#37244
重大变化
🌐 Breaking Changes
行为已更改:ipcRenderer 不能再通过 contextBridge 发送
🌐 Behavior Changed: ipcRenderer can no longer be sent over the contextBridge
尝试将整个 ipcRenderer 模块作为对象通过 contextBridge 发送,现在会导致桥接接收端收到一个空对象。此更改是为了消除/减轻安全风险。你不应直接在桥接中暴露 ipcRenderer 或其方法。相反,应提供如下的安全封装器:
🌐 Attempting to send the entire ipcRenderer module as an object over the contextBridge will now result in
an empty object on the receiving side of the bridge. This change was made to remove / mitigate
a security footgun. You should not directly expose ipcRenderer or its methods over the bridge.
Instead, provide a safe wrapper like below:
contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args)),
});
已移除:app 上的 renderer-process-crashed 事件
🌐 Removed: renderer-process-crashed event on app
app 上的 renderer-process-crashed 事件已被移除。请改用新的 render-process-gone 事件。
🌐 The renderer-process-crashed event on app has been removed.
Use the new render-process-gone event instead.
// Removed
app.on('renderer-process-crashed', (event, webContents, killed) => {
/* ... */
});
// Replace with
app.on('render-process-gone', (event, webContents, details) => {
/* ... */
});
已移除:WebContents 和 <webview> 上的 crashed 事件
🌐 Removed: crashed event on WebContents and <webview>
WebContents 和 <webview> 的 crashed 事件已被移除。
请改用新的 render-process-gone 事件。
🌐 The crashed events on WebContents and <webview> have been removed.
Use the new render-process-gone event instead.
// Removed
win.webContents.on('crashed', (event, killed) => {
/* ... */
});
webview.addEventListener('crashed', (event) => {
/* ... */
});
// Replace with
win.webContents.on('render-process-gone', (event, details) => {
/* ... */
});
webview.addEventListener('render-process-gone', (event) => {
/* ... */
});
已移除:app 上的 gpu-process-crashed 事件
🌐 Removed: gpu-process-crashed event on app
app 上的 gpu-process-crashed 事件已被移除。请改用新的 child-process-gone 事件。
🌐 The gpu-process-crashed event on app has been removed.
Use the new child-process-gone event instead.
// Removed
app.on('gpu-process-crashed', (event, killed) => {
/* ... */
});
// Replace with
app.on('child-process-gone', (event, details) => {
/* ... */
});
26.x.y 支持终止
🌐 End of Support for 26.x.y
根据项目的支持政策,Electron 26.x.y 已达到支持结束。建议开发者和应用升级到更新版本的 Electron。
🌐 Electron 26.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.
| E29(2024年2月) | E30(2024年4月) | E31(2024年6月) |
|---|---|---|
| 29.x.y | 30.x.y | 31.x.y |
| 28.x.y | 29.x.y | 30.x.y |
| 27.x.y | 28.x.y | 29.x.y |
下一步计划
🌐 What's Next
你知道 Electron 最近新增了一个社区征求意见(RFC)进程吗?如果你想向框架添加功能,RFC 可以作为与维护者就其设计展开对话的有用工具。你还可以在拉取请求中看到正在讨论的即将变更。想了解更多信息,请查看我们的Introducing electron/rfcs 博客文章,或直接查看electron/rfcs 仓库的自述文件。
🌐 Did you know that Electron recently added a community Request for Comments (RFC) process? If you want to add a feature to the framework, RFCs can be a useful tool to start a dialogue with maintainers on its design. You can also see upcoming changes being discussed in the Pull Requests. To learn more, check out our Introducing electron/rfcs blog post, or check out the README of the electron/rfcs repository directly.
短期内,你可以预期团队将继续专注于跟上构成 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.