Skip to main content

Electron 13.0.0

· 7 min read

Electron 13.0.0 已发布!此更新包含对 Chromium 91 和 V8 9.1 的升级。我们添加了多个 API 更新、错误修复和常规改进。请阅读下文了解更多详情!

¥Electron 13.0.0 has been released! It includes upgrades to Chromium 91 and V8 9.1. We've added several API updates, bug fixes, and general improvements. Read below for more details!


Electron 团队非常高兴地宣布 Electron 13.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息,并请分享你的任何反馈!

¥The Electron team is excited to announce the release of Electron 13.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, and please share any feedback you have!

显著变化

¥Notable Changes

技术栈变更

¥Stack Changes

亮点功能

¥Highlight Features

  • 添加了 process.contextIsolated 属性,用于指示当前渲染器上下文是否启用了 contextIsolation#28252

    ¥Added process.contextIsolated property that indicates whether the current renderer context has contextIsolation enabled. #28252

  • 添加了新的 session.storagePath API,用于获取会话特定数据在磁盘上的路径。#28866

    ¥Added new session.storagePath API to get the path on disk for session-specific data. #28866

  • 已弃用 WebContentsnew-window 事件。它已被 webContents.setWindowOpenHandler() 取代

    ¥Deprecated the new-window event of WebContents. It is replaced by webContents.setWindowOpenHandler()

  • 已添加 @electron/remote 使用的 process.contextId#28251

    ¥Added process.contextId used by @electron/remote. #28251

请参阅 13.0.0 发行说明 获取新功能和变更的完整列表。

¥See the 13.0.0 release notes for a full list of new features and changes.

重大变化

¥Breaking Changes

  • window.open() 参数 frameName 不再设置为窗口标题。#27481

    ¥window.open() parameter frameName is no longer set as window title. #27481

  • 已将 session.setPermissionCheckHandler(handler) 更改为允许 handler 的第一个参数 webContentsnull#19903

    ¥Changed session.setPermissionCheckHandler(handler) to allow for handler's first parameter, webContents to be null. #19903

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

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

API 变更

¥API Changes

  • BrowserWindow 添加了 roundedCorners 选项。#27572

    ¥Added roundedCorners option for BrowserWindow. #27572

  • 添加了新的 session.storagePath API,用于获取会话特定数据在磁盘上的路径。28866

    ¥Added new session.storagePath API to get the path on disk for session-specific data.28866

  • 添加了通过上下文桥传递 DOM 元素的支持。#26776

    ¥Added support for passing DOM elements over the context bridge. #26776

  • 已将 process.uptime() 添加到沙盒渲染器。#26684

    ¥Added process.uptime() to sandboxed renderers. #26684

  • 为作为 context-menu 事件一部分发出的参数添加了缺失的字段。#26788

    ¥Added missing fields to the parameters emitted as part of the context-menu event.#26788

  • 添加了对注册 Manifest V3 扩展服务工作线程的支持。

    ¥Added support for registering Manifest V3 extension service workers.

  • 为 ServiceWorkers 添加了“registration-completed”事件。#27562

    ¥Added ‘registration-completed’ event to ServiceWorkers. #27562

移除/弃用的变更

¥Removed/Deprecated Changes

以下 API 已被删除或弃用:

¥The following APIs have been removed or are now deprecated:

  • 已弃用 WebContentsnew-window 事件。它已被 webContents.setWindowOpenHandler() 取代

    ¥Deprecated the new-window event of WebContents. It is replaced by webContents.setWindowOpenHandler()

  • 移除了已弃用的 shell.moveItemToTrash()#26723

    ¥Removed deprecated shell.moveItemToTrash(). #26723

  • 移除了以下已弃用的 BrowserWindow 扩展 API:

    ¥Removed the following deprecated BrowserWindow extension APIs:

    • BrowserWindow.addExtension(path)

    • BrowserWindow.addDevToolsExtension(path)

    • BrowserWindow.removeExtension(name)

    • BrowserWindow.removeDevToolsExtension(name)

    • BrowserWindow.getExtensions()

    • BrowserWindow.getDevToolsExtensions()

    请改用 session API:

    ¥Use the session APIs instead:

    • ses.loadExtension(path)

    • ses.removeExtension(extension_id)

    • ses.getAllExtensions()

  • 以下 systemPreferences 方法已被弃用:

    ¥The following systemPreferences methods have been deprecated:

    • systemPreferences.isDarkMode()

    • systemPreferences.isInvertedColorScheme()

    • systemPreferences.isHighContrastColorScheme()

    请改用以下 nativeTheme 属性:

    ¥Use the following nativeTheme properties instead:

    • nativeTheme.shouldUseDarkColors

    • nativeTheme.shouldUseInvertedColorScheme

    • nativeTheme.shouldUseHighContrastColors

10.x.y 终止支持

¥End of Support for 10.x.y

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

¥Electron 10.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.

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。虽然我们谨慎地不对发布日期做出承诺,但我们计划大约每季度发布一次 Electron 的新主要版本及其组件的新版本。暂定 14.0.0 计划 模块列出了 Electron 14.0 开发生命周期中的关键日期。此外,查看我们的版本控制文档 提供了有关 Electron 版本控制的更多详细信息。

¥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. Although we are careful not to make promises about release dates, our plan is release new major versions of Electron with new versions of those components approximately quarterly. The tentative 14.0.0 schedule maps out key dates in the Electron 14.0 development life cycle. Also, see our versioning document for more detailed information about versioning in Electron.

有关即将推出的 Electron 版本 查看我们的“计划重大变更”文档 中计划的重大变更的信息。

¥For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.