Electron 32.0.0
Electron 32.0.0 已發布!它包含 Chromium 128.0.6613.36
、V8 12.8
和 Node 20.16.0
的升級。
Electron 團隊很高興宣布發布 Electron 32.0.0!您可以透過 npm 使用 npm install electron@latest
安裝,或從我們的發布網站下載。繼續閱讀以了解有關此版本的詳細資訊。
如果您有任何意見回饋,請在 Twitter 或 Mastodon 上與我們分享,或加入我們的社群 Discord!錯誤和功能請求可以在 Electron 的問題追蹤器中回報。
重大變更
重點
- 在我們的文件中新增了新的 API 版本歷史記錄,這是 @piotrpdev 作為 Google 程式碼夏令營一部分創建的功能。您可以在此部落格文章中了解更多資訊。#42982
- 從 Web File API 中移除非標準的 File.path 擴充功能。#42053
- 當嘗試在封鎖路徑中開啟檔案或目錄時,在 Web 檔案系統 API 中對齊失敗路徑與上游。#42993
- 將以下現有的導航相關 API 新增至
webcontents.navigationHistory
:canGoBack
、goBack
、canGoForward
、goForward
、canGoToOffset
、goToOffset
、clear
。先前的導航 API 現在已棄用。#41752
堆疊變更
- Chromium
128.0.6613.36
- Node
20.16.0
- V8
12.8
Electron 32 將 Chromium 從 126.0.6478.36
升級到 128.0.6613.36
,將 Node 從 20.14.0
升級到 20.16.0
,並將 V8 從 12.6
升級到 12.8
。
新功能
- 新增了透過
app
模組的'login'
事件來回應從公用程式處理序起始的驗證請求的支援。#43317 - 將
cumulativeCPUUsage
屬性新增至CPUUsage
結構,該屬性會傳回自處理序啟動以來使用的 CPU 時間總秒數。#41819 - 將以下現有的導航相關 API 新增至
webContents.navigationHistory
:canGoBack
、goBack
、canGoForward
、goForward
、canGoToOffset
、goToOffset
、clear
。#41752 - 擴充
WebContentsView
以接受預先存在的webContents
物件。#42086 - 在
nativeTheme
中新增了一個新的屬性prefersReducedTransparency
,表示使用者是否已選擇透過系統協助工具設定來減少 OS 層級的透明度。#43137 - 當嘗試在封鎖路徑中開啟檔案或目錄時,在檔案系統存取 API 中對齊失敗路徑與上游。#42993
- 在 Linux 上啟用 Windows 控制項覆蓋 API。#42681
- 在網路請求中啟用
zstd
壓縮。#43300
重大變更
已移除:File.path
Web File
物件的非標準 path
屬性是在早期版本的 Electron 中新增的,作為在轉譯器中進行所有操作時使用原生檔案的便利方法。但是,它表示與標準的偏差,並且也存在輕微的安全風險,因此從 Electron 32.0 開始,它已被移除,並改用 webUtils.getPathForFile
方法。
// Before (renderer)
const file = document.querySelector('input[type=file]');
alert(`Uploaded file path was: ${file.path}`);
// After (renderer)
const file = document.querySelector('input[type=file]');
electron.showFilePath(file);
// After (preload)
const { contextBridge, webUtils } = require('electron');
contextBridge.exposeInMainWorld('electron', {
showFilePath(file) {
// It's best not to expose the full file path to the web content if
// possible.
const path = webUtils.getPathForFile(file);
alert(`Uploaded file path was: ${path}`);
},
});
已棄用:WebContents
上的 clearHistory
、canGoBack
、goBack
、canGoForward
、goForward
、goToIndex
、canGoToOffset
、goToOffset
WebContents
實例上的導航相關 API 現在已棄用。這些 API 已移動到 WebContents
的 navigationHistory
屬性,以提供更結構化和直觀的介面來管理導航歷史記錄。
// Deprecated
win.webContents.clearHistory();
win.webContents.canGoBack();
win.webContents.goBack();
win.webContents.canGoForward();
win.webContents.goForward();
win.webContents.goToIndex(index);
win.webContents.canGoToOffset();
win.webContents.goToOffset(index);
// Replace with
win.webContents.navigationHistory.clear();
win.webContents.navigationHistory.canGoBack();
win.webContents.navigationHistory.goBack();
win.webContents.navigationHistory.canGoForward();
win.webContents.navigationHistory.goForward();
win.webContents.navigationHistory.canGoToOffset();
win.webContents.navigationHistory.goToOffset(index);
29.x.y 版本終止支援
根據專案的支援政策,Electron 29.x.y 版本已終止支援。建議開發者和應用程式升級至較新版本的 Electron。
E32 (2024 年 8 月) | E33 (2024 年 10 月) | E34 (2025 年 1 月) |
---|---|---|
32.x.y | 33.x.y | 34.x.y |
31.x.y | 32.x.y | 33.x.y |
30.x.y | 31.x.y | 32.x.y |
接下來的發展
短期內,您可以預期團隊將繼續專注於跟上組成 Electron 的主要元件的開發進度,包括 Chromium、Node 和 V8。
您可以在此處找到 Electron 的公開時程表。
有關未來變更的更多資訊,請參閱計畫中的重大變更頁面。