Electron 28.0.0
Electron 28.0.0 已發佈!它包含 Chromium 120.0.6099.56
、V8 12.0
和 Node.js 18.18.2
的升級。
Electron 團隊很高興宣布 Electron 28.0.0 的發佈!您可以使用 npm 透過 npm install electron@latest
安裝它,或從我們的發佈網站下載它。請繼續閱讀有關此版本的詳細資訊。
如果您有任何意見回饋,請在 Twitter 或 Mastodon 上與我們分享,或加入我們的社群 Discord!錯誤和功能要求可以在 Electron 的問題追蹤器中報告。
重大變更
重點
- 實作了對 ECMAScript 模組或 ESM 的支援(什麼是 ECMAScript 模組?在此處了解更多資訊)。這包括在 Electron 本身以及
UtilityProcess
API 進入點等區域中對 ESM 的支援。請參閱我們的 ESM 文件以取得更多詳細資訊。 - 除了在 Electron 本身啟用 ESM 支援外,Electron Forge 也支援使用 ESM 來封裝、建置和開發 Electron 應用程式。您可以在Forge v7.0.0 或更高版本中找到此支援。
堆疊變更
- Chromium
120.0.6099.56
- Chrome 119 和 DevTools 119 的新功能
- Chrome 120 和 DevTools 120 的新功能
- Node
18.18.2
- V8
12.0
新功能
- 啟用 ESM 支援。#37535
- 如需更多詳細資訊,請參閱ESM 文件。
- 將 ESM 進入點新增至
UtilityProcess
API。#40047 - 將多個屬性新增至
display
物件,包括detected
、maximumCursorSize
和nativeOrigin
。#40554 - 新增對 Linux 上
ELECTRON_OZONE_PLATFORM_HINT
環境變數的支援。#39792
重大變更
行為變更:WebContents.backgroundThrottling
設為 false 會影響主機 BrowserWindow
中的所有 WebContents
WebContents.backgroundThrottling
設為 false 將會針對其顯示的所有 WebContents
停用 BrowserWindow
中的影格節流。
已移除:BrowserWindow.setTrafficLightPosition(position)
已移除 BrowserWindow.setTrafficLightPosition(position)
,應改用 BrowserWindow.setWindowButtonPosition(position)
API,其接受 null
而不是 { x: 0, y: 0 }
,以將位置重設為系統預設值。
// Removed in Electron 28
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });
// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);
已移除:BrowserWindow.getTrafficLightPosition()
已移除 BrowserWindow.getTrafficLightPosition()
,應改用 BrowserWindow.getWindowButtonPosition()
API,當沒有自訂位置時,它會傳回 null
而不是 { x: 0, y: 0 }
。
// Removed in Electron 28
const pos = win.getTrafficLightPosition();
if (pos.x === 0 && pos.y === 0) {
// No custom position.
}
// Replace with
const ret = win.getWindowButtonPosition();
if (ret === null) {
// No custom position.
}
已移除:ipcRenderer.sendTo()
ipcRenderer.sendTo()
API 已被移除。應改為在渲染器之間設定一個 MessageChannel
。
IpcRendererEvent
的 senderId
和 senderIsMainFrame
屬性也已移除。
已移除:app.runningUnderRosettaTranslation
app.runningUnderRosettaTranslation
屬性已被移除。請改用 app.runningUnderARM64Translation
。
// Removed
console.log(app.runningUnderRosettaTranslation);
// Replace with
console.log(app.runningUnderARM64Translation);
25.x.y 版本終止支援
根據專案的支援政策,Electron 25.x.y 版本已終止支援。建議開發者和應用程式升級到較新版本的 Electron。
E28 (23年12月) | E29 (24年2月) | E30 (24年4月) |
---|---|---|
28.x.y | 29.x.y | 30.x.y |
27.x.y | 28.x.y | 29.x.y |
26.x.y | 27.x.y | 28.x.y |
下一步
短期內,您可以預期團隊將繼續專注於跟上構成 Electron 的主要組件(包括 Chromium、Node 和 V8)的開發進度。
您可以在這裡找到 Electron 的公開時程表。
有關未來變更的更多資訊,請參閱計劃的重大變更頁面。