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 install electron@latest
使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。
¥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
亮点
¥Highlights
-
添加了新的顶层
webUtils
模块,这是一个渲染器进程模块,它提供了一个与 Web API 对象交互的实用程序层。模块中第一个可用的 API 是webUtils.getPathForFile
。Electron 之前的File.path
增强功能与 Web 标准有所偏差;这个新的 API 更符合当前的 Web 标准行为。¥Added a new top-level
webUtils
module, a renderer process module that provides a utility layer to interact with Web API objects. The first available API in the module iswebUtils.getPathForFile
. Electron's previousFile.path
augmentation was a deviation from web standards; this new API is more in line with current web standards behavior.
技术栈变更
¥Stack Changes
-
Chromium
122.0.6261.39
-
Chrome 122 和 DevTools 122 中的新功能
¥New in Chrome 122 and in DevTools 122
-
Chrome 121 和 DevTools 121 中的新功能
¥New in Chrome 121 and in DevTools 121
-
-
Node
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¥Added new
webUtils
module, a utility layer to interact with Web API objects, to replaceFile.path
augmentation. #38776 -
¥Added net module to utility process. #40890
-
添加了新的 Electron Fuse,即
grantFileProtocolExtraPrivileges
,它将file://
协议设置为与 Chromium 匹配的更安全、更严格的行为。#40372¥Added a new Electron Fuse,
grantFileProtocolExtraPrivileges
, that opts thefile://
protocol into more secure and restrictive behaviour that matches Chromium. #40372 -
在
protocol.registerSchemesAsPrivileged
中添加了一个选项,允许在自定义方案中使用 V8 代码缓存。#40544¥Added an option in
protocol.registerSchemesAsPrivileged
to allow V8 code cache in custom schemes. #40544 -
已迁移
app.{set|get}LoginItemSettings(settings)
,以便在 macOS 13.0+ 上使用 Apple 推荐的新底层框架。#37244¥Migrated
app.{set|get}LoginItemSettings(settings)
to use Apple's new recommended underlying framework on 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 可以成为与维护人员就其设计展开对话的有用工具。你还可以在 Pull 请求中查看即将讨论的变更。要了解更多信息,请查看我们的 electron/rfcs 介绍 博客文章,或直接查看 electron/rfcs 代码库的 README 文件。
¥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.