Electron 29.0.0
Electron 29.0.0 已發布!它包含 Chromium 122.0.6261.39
、V8 12.2
和 Node.js 20.9.0
的升級。
Electron 團隊很高興宣布發布 Electron 29.0.0!您可以使用 npm 透過 npm install electron@latest
安裝,或從我們的發行版本網站下載。繼續閱讀以了解有關此版本的詳細資訊。
如果您有任何意見回饋,請在 Twitter 或 Mastodon 上與我們分享,或加入我們的社群 Discord!錯誤和功能要求可以在 Electron 的問題追蹤器中回報。
重大變更
重點
- 新增了新的頂層
webUtils
模組,這是一個渲染器程序模組,提供一個公用程式層來與 Web API 物件互動。模組中的第一個可用 API 是webUtils.getPathForFile
。Electron 之前的File.path
增強功能偏離了 Web 標準;這個新的 API 更符合當前的 Web 標準行為。
堆疊變更
- Chromium
122.0.6261.39
- Chrome 122 和 DevTools 122 中的新功能
- Chrome 121 和 DevTools 121 中的新功能
- Node
20.9.0
- V8
12.2
Electron 29 將 Chromium 從 120.0.6099.56
升級到 122.0.6261.39
,將 Node 從 18.18.2
升級到 20.9.0
,並將 V8 從 12.0
升級到 12.2
。
新功能
- 新增了新的
webUtils
模組,這是一個與 Web API 物件互動的公用程式層,以取代File.path
增強功能。#38776 - 將 net 模組新增至公用程式程序。#40890
- 新增了一個新的Electron Fuse,
grantFileProtocolExtraPrivileges
,它將file://
協定選擇加入更安全和限制性的行為,與 Chromium 相符。#40372 - 在
protocol.registerSchemesAsPrivileged
中新增了一個選項,允許在自訂協定中使用 V8 程式碼快取。#40544 - 將
app.{set|get}LoginItemSettings(settings)
遷移到在 macOS 13.0+ 上使用 Apple 新建議的底層框架。#37244
重大變更
行為已變更:ipcRenderer
無法再透過 contextBridge
傳送
嘗試將整個 ipcRenderer
模組作為物件透過 contextBridge
傳送,現在會在橋接的接收端產生一個空物件。進行此變更是為了移除/減輕安全漏洞。您不應透過橋接直接公開 ipcRenderer 或其方法。而是提供如下的安全包裝器
contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args)),
});
已移除:app
上的 renderer-process-crashed
事件
app
上的 renderer-process-crashed
事件已移除。請改用新的 render-process-gone
事件。
// Removed
app.on('renderer-process-crashed', (event, webContents, killed) => {
/* ... */
});
// Replace with
app.on('render-process-gone', (event, webContents, details) => {
/* ... */
});
已移除:WebContents
和 <webview>
上的 crashed
事件
WebContents
和 <webview>
上的 crashed
事件已移除。請改用新的 render-process-gone
事件。
// Removed
win.webContents.on('crashed', (event, killed) => {
/* ... */
});
webview.addEventListener('crashed', (event) => {
/* ... */
});
// Replace with
win.webContents.on('render-process-gone', (event, details) => {
/* ... */
});
webview.addEventListener('render-process-gone', (event) => {
/* ... */
});
已移除:app
上的 gpu-process-crashed
事件
app
上的 gpu-process-crashed
事件已移除。請改用新的 child-process-gone
事件。
// Removed
app.on('gpu-process-crashed', (event, killed) => {
/* ... */
});
// Replace with
app.on('child-process-gone', (event, details) => {
/* ... */
});
26.x.y 版本終止支援
根據專案的支援政策,Electron 26.x.y 版本已終止支援。建議開發者和應用程式升級至較新版本的 Electron。
E29 (2 月 '24) | E30 (4 月 '24) | E31 (6 月 '24) |
---|---|---|
29.x.y | 30.x.y | 31.x.y |
28.x.y | 29.x.y | 30.x.y |
27.x.y | 28.x.y | 29.x.y |
下一步
您知道 Electron 最近新增了社群「徵求意見 (RFC)」流程嗎?如果您想為框架新增功能,RFC 可以作為與維護者討論設計的起點。您也可以在 Pull Requests 中查看即將討論的變更。若要了解更多資訊,請查看我們的Introducing electron/rfcs 部落格文章,或直接查看 electron/rfcs 儲存庫的 README。
短期內,您可以預期團隊會繼續專注於跟上組成 Electron 的主要元件(包括 Chromium、Node 和 V8)的開發進度。
您可以在這裡找到 Electron 的公開時程表。
有關未來變更的更多資訊,請參閱計畫中的重大變更頁面。