跳到主要內容

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 的 issue 追蹤器中回報。

重大變更

堆疊變更

重大變更

已移除:macOS 10.13 / 10.14 支援

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

舊版本的 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 (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 的公開時程表

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