Electron 44
Electron 44 已发布!它包括了 Chromium 152.0.7977.54、V8 15.2 和 Node 24.18.1 的升级。
Electron 团队很高兴发布了 Electron 44!你可以通过 npm install electron@latest 或者从我们的发布网站下载它。继续阅读此版本的详细信息。
如果您有任何反馈,请在 Bluesky 或 Mastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。
重要变化
clipboard 模块现在与 W3C 剪贴板 API 一致
Electron's clipboard module has been rearchitected to align with the W3C Clipboard API. Its read and write methods are now asynchronous, and the new ClipboardItem class provides a MIME-based interface for working with clipboard data. On Linux, the selection clipboard is now available through the clipboard.selection namespace. See RFC 0019 and the planned breaking changes document for migration details. #52508
As part of this change, the clipboard module is no longer exposed directly to renderer processes. Renderers should use navigator.clipboard, or carefully expose only the required functionality from a preload script through contextBridge.
Cross-platform window state persistence
Electron 44 adds API for saving and restoring window state. Set windowStatePersistence: true and provide a unique name in the BaseWindow or BrowserWindow constructor to preserve the window's position, size, and display mode across launches. Applications can selectively persist bounds or display modes, and clear saved state with BaseWindow.clearPersistedState(). See the Window State Persistence tutorial for details. #52270
Improved Linux desktop integration
Electron 44 restores app.setBadgeCount() and win.setProgressBar() on Linux without requiring libunity. These APIs now work with docks and taskbars that implement the LauncherEntry D-Bus API. This release also adds win.setOpacity() support, system-themed Window Controls Overlay icons, and other improvements for frameless windows on Linux. #52895 #51455 #52531
架构(Stack)更新
-
Chromium
152.0.7977.54 -
Node
v24.18.1 -
V8
15.2
Electron 44 upgrades Chromium from 150.0.7871.46 to 152.0.7977.54, Node.js from v24.17.0 to v24.18.1, and V8 from 15.0 to 15.2.
New Features and Improvements
- Added
availabletoprocess.getSystemMemoryInfo()on Linux, exposingMemAvailablefrom/proc/meminfo. #52380 (Also in 42, 43) - Added
net.WebSocket, a WHATWG-compatible WebSocket client for the main process that routes through Chromium's network stack. #51593 (Also in 42, 43) - Added
webContents.setZoomMode(mode),webContents.getZoomMode(), andwebContents.zoomModefor per-WebContentszoom control. #49962 - Added
webFrameMain.printToPDF()to allow printing individual frames to PDF from the main process. #52625 (Also in 42, 43) - Added
windowStatePersistencetoBaseWindowandBrowserWindowfor saving and restoring window bounds and display modes across launches. #52270 - Added a
badgeproperty toMenuItemon macOS 14 and later for showing a count or custom text badge next to a menu item's label. #53046 - Added support for
win.setOpacity(opacity)on Linux. #51455 - Added
webContents.caretBrowsingEnabledfor toggling caret browsing in aWebContents. #53035 - Frameless windows on Linux now use system-themed titlebar icons for Window Controls Overlay. #52531
- Restored
app.setBadgeCount()andwin.setProgressBar()for Linux. These APIs now support any dock or taskbar that implements the LauncherEntry D-Bus API, and they no longer requirelibunity. #52895 - Made various performance improvements related to initialization and IPC. #53017 (Also in 42, 43)
- Improved application startup time on Linux by skipping GDK's OpenGL probe and loading FontConfig off the main thread during toolkit initialization. #53107 (也在 43 中)
- Improved runtime performance by consuming Electron-generated PGO profiles instead of Chrome's published profiles. #51815 (Also in 42, 43)
- Improved startup time of
utilityProcess.fork(),child_process.fork(),ELECTRON_RUN_AS_NODEchild processes, and Node.js-enabled renderers. #53134 (Also in 42, 43) - Linux arm64, Windows arm64, and macOS x64 builds now start the main process from the embedded Node.js startup snapshot like the other platforms. #52879 (Also in 42, 43)
- Reduced idle main-process CPU wakeups caused by Node.js timers and immediates. #52906 (也在 43 中)
- Reduced the Linux distribution size by approximately 37 MB by shipping only the locale strings and resources that Electron can use. #51804
- The first sandboxed
BrowserWindownow starts in a renderer process launched ahead of time when the default session already exists. Apps that open many windows can keep a spare renderer warm with--enable-features=SpareRendererForSitePerProcess. #53144
重大更改
移除:macOS 12 支持
macOS 12 (Montrey) 不再被 Chromium支持。旧版本的 Electron 将继续在 Monterey 运行,但需要 macOS 13 (Ventura) 或更高版本才能运行 Electron 44 及之后的版本。 #51967
行为改变:webContents 在 select-client-certificate 中可能为 null
app 的 'selected t-client-certificate' 事件现在也会在通过 net 模块和使用 repeitToAuthRequestsFromMainProcess: true 创建的实用进程发出的请求中被触发。对于这些请求,webContents 参数是 null。使用此事件的应用程序必须在使用该参数之前检查参数。 #52397
这也意味着 net.request() 和 net.fetch() 现在可以选择客户端证书,而不是在服务器请求证书时出现 ERR_SSL_CLIENT_AUTH_CERT_NEEDED 错误。
Behavior Changed: ANGLE is statically linked on all platforms
ANGLE 现在在全平台静态链接至 Electron 二进制文件中,与 Chromium 上游相同。 libEGL.(so|dylib|dll) 和 libGLESv2.(So|dylib|dll) 库不再一同发布。通过替换这些库来使用自有的 ANGLE 的应用程序已不再能够这样做。 #52288
行为改变:net.request 拒绝使用没有浏览模式的目标框架
net.request 现在拒绝 Sec-Fetch-Dest 为 document、frame、iframe 或 fencedframe 的请求,除非 Sec-Fetch-Mode 也设置为 navigate。这与 Chromium 的行为相匹配,即框架类型请求的用处必须是浏览。 #52216
Removed: Unity desktop environment support on Linux
Electron 不再在 Linux 上提供 Unity 相关的集成,并且 app.isUnityRunning() 已被删除。 Electron 仍支持现代的 Freedesktop 标准。 #51649
已移除:Windows 32 位和 Linux 32 位 ARM 架构支持
Electron 不再发布 Windows x86 (win32-ia32) 或 Linux ARM (linux-armv7l) 的预编译二进制文件。 Electron 44 及更高版本仅支持 64 位的 x64 及 arm64 平台。旧的 Electron 版本将继续支持这些平台,直到 Electron 43 系列在 2027 年一月结束支持为止。 #52326
已移除:渲染进程中 clipboard 模块的访问权限
clipboard 模块不再直接暴露在渲染进程中。渲染进程应该使用 Web 平台的 navigator.clipboard API。对于更高级的用例,只能通过 contextBridge 从预加载脚本中暴露辅助函数, 注意不要让不受信任的内容访问剪贴板。 #52508
API 更改:clipboard 模块已重新设计,以与 W3C 剪贴板API 一致
clipboard 模块的 read()、write()、readText()、writeText() 和 has() 方法现在是异步的。剪贴板数据由新的 ClipboardItem 类呈现,并且用例较少的辅助函数,例如 readImage()、writeHTML() 和 availableFormats() 已被删除。 Linux 的选择剪贴板现在可以通过 clipboard.selection 获取。完整的 API 映射和示例请参阅迁移指南。 #52508
Removed: Pre-macOS 13 login item attributes
openAsHidden 选项已从 app.setLoginItemSettings() 中移除,并且 openAsHidden、wasopenedAsidden 和 restoreState 字段已从 app.getLoginItemSettings() 的返回值中移除。这些属性仅适用于 macOS 12 和更早版本,但是 Electron 44 不再支持这些版本。 #52667
终止对 41.x.y 的支持
根据项目的支持政策,Electron 41.x.y 已经达到了支持的终点。我们鼓励开发者将应用程序升级到更新的 Electron 版本。 See https://releases.electronjs.org/schedule to see the timeline for supported versions of Electron.
接下来
在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。
您可以在此处找到 Electron 的公开时间表。
有关这些和未来变化的更多信息可在计划的突破性变化页面找到。
