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 的 issue tracker 中回報。
重大變更
重點
- 在我們的文件中新增了新的 API 版本歷史記錄,這是 @piotrpdev 作為 Google Summer of Code 的一部分創建的功能。您可以在這篇部落格文章中了解更多相關資訊。 #42982
- 從 Web File API 中移除非標準的 File.path 擴充功能。 #42053
- 當嘗試在封鎖路徑中開啟檔案或目錄時,使 Web File System 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
屬性,指出使用者是否已選擇透過系統輔助功能設定來減少作業系統層級的透明度。 #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);
行為變更:userData
中的目錄 databases
將被刪除
如果您在 app.getPath('userData')
傳回的目錄中有名為 databases
的目錄,則在首次執行 Electron 32 時將會刪除它。databases
目錄由 WebSQL 使用,WebSQL 已在 Electron 31 中移除。Chromium 現在執行清理以刪除此目錄。請參閱issue #45396。
終止對 29.x.y 的支援
根據專案的支援政策,Electron 29.x.y 已終止支援。建議開發人員和應用程式升級到較新版本的 Electron。
E32 (24 年 8 月) | E33 (24 年 10 月) | E34 (25 年 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 的公開時程表。
有關未來變更的更多資訊,請參閱計畫的重大變更頁面。