跳到主要内容

Electron 27.0.0

·阅读 4 分钟

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


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

如果您有任何反馈,请通过 TwitterMastodon 与我们分享,或加入我们的社区 Discord!Bug 和功能请求可以在 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 来替换它。

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被弃用。

已移除: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 的公开时间表

有关未来变更的更多信息,请参阅计划的重大变更页面。