Skip to main content

Electron 27.0.0

· 7 min read

Electron 27.0.0 已发布!它包括对 Chromium 118.0.5993.32、V8 11.8 和 Node.js 18.17.1 的升级。

🌐 Electron 27.0.0 has been released! It includes upgrades to Chromium 118.0.5993.32, V8 11.8, and Node.js 18.17.1.


Electron 团队很高兴地宣布发布 Electron 27.0.0!你可以通过 npm 使用 npm install electron@latest 安装,或从我们的发布网站下载。请继续阅读以了解此次发布的详细信息。

🌐 The Electron team is excited to announce the release of Electron 27.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.

如果你有任何反馈,请通过 TwitterMastodon 与我们分享,或者加入我们的社区 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.

技术栈变更

🌐 Stack Changes

重大变化

🌐 Breaking Changes

已移除:支持 macOS 10.13 / 10.14

🌐 Removed: macOS 10.13 / 10.14 support

macOS 10.13(High Sierra)和 macOS 10.14(Mojave)已不再受到 Chromium 的支持。

🌐 macOS 10.13 (High Sierra) and macOS 10.14 (Mojave) are no longer supported by Chromium.

旧版本的 Electron 仍然可以在这些操作系统上运行,但运行 Electron v27.0.0 及更高版本将需要 macOS 10.15(Catalina)或更高版本。

🌐 Older versions of Electron will continue to run on these operating systems, but macOS 10.15 (Catalina) or later will be required to run Electron v27.0.0 and higher.

已弃用:ipcRenderer.sendTo()

🌐 Deprecated: ipcRenderer.sendTo()

ipcRenderer.sendTo() API 已被弃用。应该通过在渲染器之间设置 MessageChannel 来替代。

🌐 The ipcRenderer.sendTo() API has been deprecated. It should be replaced by setting up a MessageChannel between the renderers.

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被弃用。

🌐 The senderId and senderIsMainFrame properties of IpcRendererEvent have been deprecated as well.

已移除:systemPreferences 中的配色方案事件

🌐 Removed: color scheme events in systemPreferences

以下 systemPreferences 事件已被移除:

🌐 The following systemPreferences events have been removed:

  • inverted-color-scheme-changed
  • high-contrast-color-scheme-changed

请改用 nativeTheme 模块上的新 updated 事件。

🌐 Use the new updated event on the nativeTheme module instead.

// Removed
systemPreferences.on('inverted-color-scheme-changed', () => {
/* ... */
});
systemPreferences.on('high-contrast-color-scheme-changed', () => {
/* ... */
});

// Replace with
nativeTheme.on('updated', () => {
/* ... */
});

已移除:webContents.getPrinters

🌐 Removed: webContents.getPrinters

webContents.getPrinters 方法已被移除。请改用 webContents.getPrintersAsync

🌐 The webContents.getPrinters method has been removed. Use webContents.getPrintersAsync instead.

const w = new BrowserWindow({ show: false });

// Removed
console.log(w.webContents.getPrinters());
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

已移除:systemPreferences.{get,set}AppLevelAppearancesystemPreferences.appLevelAppearance

🌐 Removed: systemPreferences.{get,set}AppLevelAppearance and systemPreferences.appLevelAppearance

systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 方法已被移除,systemPreferences.appLevelAppearance 属性也已被移除。请改用 nativeTheme 模块。

🌐 The systemPreferences.getAppLevelAppearance and systemPreferences.setAppLevelAppearance methods have been removed, as well as the systemPreferences.appLevelAppearance property. Use the nativeTheme module instead.

// Removed
systemPreferences.getAppLevelAppearance();
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.appLevelAppearance;
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.setAppLevelAppearance('dark');
// Replace with
nativeTheme.themeSource = 'dark';

已移除:systemPreferences.getColoralternate-selected-control-text

🌐 Removed: alternate-selected-control-text value for systemPreferences.getColor

systemPreferences.getColoralternate-selected-control-text 值已被移除。请改用 selected-content-background

🌐 The alternate-selected-control-text value for systemPreferences.getColor has been removed. Use selected-content-background instead.

// Removed
systemPreferences.getColor('alternate-selected-control-text');
// Replace with
systemPreferences.getColor('selected-content-background');

新功能

🌐 New Features

  • 添加了应用可访问性透明度设置 API #39631
  • 添加了对 chrome.scripting 扩展 API 的支持 #39675
  • 默认启用 WaylandWindowDecorations #39644

24.x.y 支持终止

🌐 End of Support for 24.x.y

根据项目的支持政策,Electron 24.x.y 已结束支持。我们鼓励开发者和应用升级到更新的 Electron 版本。

🌐 Electron 24.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.

E27(2023年10月)E28(2023年12月)E29(2024年2月)
27.x.y28.x.y29.x.y
26.x.y27.x.y28.x.y
25.x.y26.x.y27.x.y

22.x.y 扩展支持终止

🌐 End of Extended Support for 22.x.y

今年早些时候,Electron 团队将 Electron 22 的预计使用终止日期从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日,以配合 Chrome 对 Windows 7/8/8.1 的延长支持(更多详情见 告别 Windows 7/8/8.1)。

🌐 Earlier this year, the Electron team extended Electron 22's planned end of life date from May 30, 2023 to October 10, 2023, in order to match Chrome's extended support for Windows 7/8/8.1 (see Farewell, Windows 7/8/8.1 for more details).

根据项目的支持政策和此次支持延长,Electron 22.x.y 已达到支持终止阶段。这将把支持范围缩回到最近的三个稳定主版本,同时将结束对 Windows 7/8/8.1 的官方支持。

🌐 Electron 22.x.y has reached end-of-support as per the project's support policy and this support extension. This will drop support back to the latest three stable major versions, and will end official support for Windows 7/8/8.1.

下一步计划

🌐 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.