跳至主要內容

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 支援

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

舊版本的 Electron 將繼續在這些作業系統上執行,但需要 macOS 10.15 (Catalina) 或更新版本才能執行 Electron v27.0.0 及更高版本。

已棄用: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 (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 的延長支援

今年初,Electron 團隊為了配合 Chrome 對 Windows 7/8/8.1 的延長支援(詳情請見告別 Windows 7/8/8.1),將 Electron 22 的原定終止支援日期從 2023 年 5 月 30 日延長至 2023 年 10 月 10 日。

根據專案的支援政策和此項延長支援,Electron 22.x.y 版本已終止支援。這將把支援版本縮減回最新的三個穩定主要版本,並結束對 Windows 7/8/8.1 的官方支援。

下一步

短期內,您可以預期團隊將繼續專注於跟上構成 Electron 的主要組件(包括 Chromium、Node 和 V8)的開發進度。

您可以在此處找到 Electron 的公開時程表

關於未來變更的更多資訊,請參閱計劃中的重大變更頁面。