Electron 22.0.0
Electron 22.0.0 已发布!它包含一个新的实用程序进程 API,对 Windows 7/8/8.1 的支持进行了更新,并升级了 Chromium 108、V8 10.8 和 Node.js 16.17.1。详见以下内容!
🌐 Electron 22.0.0 has been released! It includes a new utility process API, updates for Windows 7/8/8.1 support, and upgrades to Chromium 108, V8 10.8, and Node.js 16.17.1. Read below for more details!
Electron 团队很高兴地宣布发布 Electron 22.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。
🌐 The Electron team is excited to announce the release of Electron 22.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 与我们分享,或加入我们的社区 Discord!你可以在 Electron 的 问题追踪器 中报告错误和功能请求。
🌐 If you have any feedback, please share it with us on Twitter, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.
Windows 7/8/8.1 支持更新
🌐 Windows 7/8/8.1 Support Update
2023/02/16:关于 Windows Server 2012 支持的更新
上个月,谷歌宣布Chrome 109将继续为Windows Server 2012和Windows Server 2012 R2提供关键安全修复,直到2023年10月10日。根据这一安排,Electron 22(Chromium 108)的计划终止支持日期将从2023年5月30日延长至2023年10月10日。Electron 团队将继续将该计划中的任何安全修复回移到 Electron 22,直至2023年10月10日。
🌐 Last month, Google announced that Chrome 109 would continue to receive critical security fixes for Windows Server 2012 and Windows Server 2012 R2 until October 10, 2023. In accordance, Electron 22's (Chromium 108) planned end of life date will be extended from May 30, 2023 to October 10, 2023. The Electron team will continue to backport any security fixes that are part of this program to Electron 22 until October 10, 2023.
请注意,我们将不会对 Windows 7/8/8.1 提供额外的安全修复。此外,正如之前所宣布的,Electron 23(Chromium 110)仅在 Windows 10 及以上版本上运行。
🌐 Note that we will not make additional security fixes for Windows 7/8/8.1. Also, Electron 23 (Chromium 110) will only function on Windows 10 and above as previously announced.
Electron 22 将是最后一个支持 Windows 7/8/8.1 的 Electron 主要版本。Electron 遵循 Chromium 的计划弃用政策,该政策将在 Chromium 109 中弃用对 Windows 7/8/8.1 的支持(在这里了解更多信息](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en))。
🌐 Electron 22 will be the last Electron major version to support Windows 7/8/8.1. Electron follows the planned Chromium deprecation policy, which will deprecate Windows 7/8/8.1 support in Chromium 109 (read more here).
Electron 23 及更高主要版本将不支持 Windows 7/8/8.1。
🌐 Windows 7/8/8.1 will not be supported in Electron 23 and later major releases.
显著变化
🌐 Notable Changes
UtilityProcess API #36089
新的 UtilityProcess 主进程模块允许创建一个轻量级的 Chromium 子进程,该子进程仅集成了 Node.js,同时也允许使用 MessageChannel 与沙盒渲染器进行通信。该 API 基于 Node.js child_process.fork 设计,以便于更轻松的过渡,主要区别在于入口点 modulePath 必须来自打包后的应用内部,以确保只加载受信任的脚本。此外,该模块默认阻止与渲染器建立通信通道,从而维持主进程是应用中唯一受信任进程的约定。
🌐 The new UtilityProcess main process module allows the creation of a lightweight Chromium child process with only Node.js integration while also allowing communication with a sandboxed renderer using MessageChannel. The API was designed based on Node.js child_process.fork to allow for easier transition, with one primary difference being that the entry point modulePath must be from within the packaged application to allow only for trusted scripts to be loaded. Additionally the module prevents establishing communication channels with renderers by default, upholding the contract in which the main process is the only trusted process in the application.
你可以在我们的文档中阅读有关 新 UtilityProcess API 的更多信息。
🌐 You can read more about the new UtilityProcess API in our docs here.
其他高亮的变更
🌐 Additional Highlighted Changes
- 在 Linux 和 Windows 上新增了对 Web 蓝牙 PIN 配对的支持。 #35416
- 添加了
LoadBrowserProcessSpecificV8Snapshot作为一个新的开关,它将允许主进程/浏览器进程从browser_v8_context_snapshot.bin的文件加载其 v8 快照。其他进程将使用与当前相同的路径。 #35266 - 添加了
WebContents.opener用于访问窗口打开者,以及webContents.fromFrame(frame)用于获取与 WebFrameMain 实例对应的 WebContents。#35140 - 通过新的会话处理器
ses.setDisplayMediaRequestHandler添加了对navigator.mediaDevices.getDisplayMedia的支持。 #30702
技术栈变更
🌐 Stack Changes
- Chromium
108 - Node.js
16.17.1 - V8
10.8
API 重大变更
🌐 Breaking API Changes
以下是 Electron 22 引入的重大变更。你可以在 计划中的重大变更 页面上阅读有关这些变更和未来变更的更多信息。
🌐 Below are breaking changes introduced in Electron 22. You can read more about these changes and future changes on the Planned Breaking Changes page.
已弃用:webContents.incrementCapturerCount(stayHidden, stayAwake)
🌐 Deprecated: webContents.incrementCapturerCount(stayHidden, stayAwake)
webContents.incrementCapturerCount(stayHidden, stayAwake) 已被弃用。
页面捕获完成后,现在由 webContents.capturePage 自动处理。
const w = new BrowserWindow({ show: false })
- w.webContents.incrementCapturerCount()
- w.capturePage().then(image => {
- console.log(image.toDataURL())
- w.webContents.decrementCapturerCount()
- })
+ w.capturePage().then(image => {
+ console.log(image.toDataURL())
+ })
已弃用:webContents.decrementCapturerCount(stayHidden, stayAwake)
🌐 Deprecated: webContents.decrementCapturerCount(stayHidden, stayAwake)
webContents.decrementCapturerCount(stayHidden, stayAwake) 已被弃用。
页面捕获完成后,现在由 webContents.capturePage 自动处理。
const w = new BrowserWindow({ show: false })
- w.webContents.incrementCapturerCount()
- w.capturePage().then(image => {
- console.log(image.toDataURL())
- w.webContents.decrementCapturerCount()
- })
+ w.capturePage().then(image => {
+ console.log(image.toDataURL())
+ })
已移除:WebContents new-window 事件
🌐 Removed: WebContents new-window event
WebContents 的 new-window 事件已被移除。它已被 webContents.setWindowOpenHandler() 替代。
🌐 The new-window event of WebContents has been removed. It is replaced by webContents.setWindowOpenHandler().
- webContents.on('new-window', (event) => {
- event.preventDefault()
- })
+ webContents.setWindowOpenHandler((details) => {
+ return { action: 'deny' }
+ })
已弃用:BrowserWindow scroll-touch-* 事件
🌐 Deprecated: BrowserWindow scroll-touch-* events
BrowserWindow 上的 scroll-touch-begin、scroll-touch-end 和 scroll-touch-edge 事件已不推荐使用。请改为使用 WebContents 上新提供的 input-event 事件。
🌐 The scroll-touch-begin, scroll-touch-end and scroll-touch-edge events on
BrowserWindow are deprecated. Instead, use the newly available
input-event event on WebContents.
// Deprecated
- win.on('scroll-touch-begin', scrollTouchBegin)
- win.on('scroll-touch-edge', scrollTouchEdge)
- win.on('scroll-touch-end', scrollTouchEnd)
// Replace with
+ win.webContents.on('input-event', (_, event) => {
+ if (event.type === 'gestureScrollBegin') {
+ scrollTouchBegin()
+ } else if (event.type === 'gestureScrollUpdate') {
+ scrollTouchEdge()
+ } else if (event.type === 'gestureScrollEnd') {
+ scrollTouchEnd()
+ }
+ })
19.x.y 支持终止
🌐 End of Support for 19.x.y
根据项目的支持政策,Electron 19.x.y 已结束支持。我们鼓励开发者和应用升级到更新的 Electron 版本。
🌐 Electron 19.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.
| E19 (2022年5月) | E20 (2022年8月) | E21 (2022年9月) | E22 (2022年11月) | E23 (2023年1月) |
|---|---|---|---|---|
| 19.x.y | 20.x.y | 21.x.y | 22.x.y | 23.x.y |
| 18.x.y | 19.x.y | 20.x.y | 21.x.y | 22.x.y |
| 17.x.y | 18.x.y | 19.x.y | 20.x.y | 21.x.y |
下一步计划
🌐 What's Next
Electron 项目将在 2022 年 12 月暂停,并于 2023 年 1 月恢复。更多信息可在 12 月停工博客文章 中找到。
🌐 The Electron project will pause for the the month of December 2022, and return in January 2023. More information can be found in the December shutdown blog post.
短期内,你可以预期团队将继续专注于跟上构成 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.