跳到主要内容

Electron 27.0.0

·3 分钟阅读

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


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

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的社区 Discord!错误和功能请求可以在 Electron 的问题跟踪器中报告。

值得关注的变更

技术栈变更

重大变更

移除:对 macOS 10.13 / 10.14 的支持

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

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

已弃用:ipcRenderer.sendTo()

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

IpcRendererEvent 的 senderIdsenderIsMainFrame 属性也已弃用。

移除:systemPreferences 中的颜色方案事件

以下 systemPreferences 事件已移除

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

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

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

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

移除:webContents.getPrinters

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

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

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

// 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

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

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

新特性

  • 添加了应用辅助功能透明度设置 API #39631
  • 添加了对 chrome.scripting 扩展 API 的支持 #39675
  • 默认启用 WaylandWindowDecorations #39644

停止支持 24.x.y

根据项目的支持策略,Electron 24.x.y 已达到支持终止日期。鼓励开发者和应用升级到更新版本的 Electron。

E27 (23 年 10 月)E28 (23 年 12 月)E29 (24 年 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

今年早些时候,Electron 团队将 Electron 22 计划的生命周期结束日期从 2023 年 5 月 30 日延长到 2023 年 10 月 10 日,以配合 Chrome 对 Windows 7/8/8.1 的扩展支持(详情请参阅 告别 Windows 7/8/8.1)。

根据项目的支持策略和本次支持延长,Electron 22.x.y 已达到支持终止日期。这将使支持版本回退到最新的三个稳定主要版本,并终止对 Windows 7/8/8.1 的官方支持。

后续计划

短期内,您可以期待团队将继续专注于跟进构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间线

有关未来变更的更多信息可以在计划的重大变更页面上找到。