跳转到主内容

40 篇博文 含有标签「发行版」

查看所有标签

Electron 32.0.0

· 阅读时间:约 5 分钟

Electron 32.0.0 已发布! 包括升级 Chromium 128.0.6613.36,和 V8 12.8 以及 Node. js 20.16.2


Electron 团队很高兴发布了 Electron 32.0.0! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

重点内容

  • 在我们的文档中添加新的 API 版本历史,一个由 @piotrpdev 创建的功能,作为Google Summer 代码的一部分。 You can learn more about it in this blog post. #42982
  • 从 Web 文件 API 中移除非标准 File.path 扩展。 #42053
  • 尝试打开受阻止路径中的文件或目录时,将 Web File System API 中的故障路径与上游对齐。 #42993
  • 将以下现有的导航相关API添加到 webContents.navigationHistory : canGoBack, goBack, canGoForward, goForward, canGoToOffset, goToOffset, clear。 旧的导航API现已被废弃。 #41752

架构(Stack)更新

Electron 32 将 Chromium 从 026.0.6478.36 升级到 128.0.6613.36, Node 从 20.14.0 升级到 20.16.1 以及 V8 从 12.6 升级到 12.8

新特性

  • 添加了对通过app模块的'login'事件,响应来自实用程序进程发起的认证请求的支持。 #43317
  • CPUUsage结构中添加了cumulativeCPUUsage属性,该属性返回自进程启动以来使用的 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

Electron 的早期版本在 Web File 对象中添加了非标准 path 属性作为在渲染器中执行所有操作更为常见时处理本机文件的便捷方法。 然而它偏离了标准,并且也带来了较小的安全风险,因此从 Electron 32 开始它已被移除,取而代之的是 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已被移动到WebContentsnavigationHistory 属性,以便为管理导航历史提供一个更有条理和直观的接口。

// 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 版本。

E26(24 年 8月)E33 (24 年 10 月)E28 (25 年 1 月)
32.x.y33.x.y34.x.y
31.x.y32.x.y33.x.y
30.x.y31.x.y32.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。

Electron 31.0.0

· 阅读时间:约 4 分钟

Electron 31.0.0 已发布! 包括升级 Chromium 126.0.6478.36,和 V8 12.6 以及 Node. js 20.14.2


Electron 团队很高兴发布了 Electron 31.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

重点内容

  • 扩展 WebContentsView 以接受预先存在的 webContents 对象 #42319
  • 添加了对 NODE_EXTRA_CA_CERTS 的支持。 #41689
  • 更新了 window.flashFrame(bool) 以在 macOS 上持续闪烁。 #41391
  • 移除了 WebSQL 支持。#41868
  • nativeImage.toDataURL 将保留 PNG 颜色空间 #41610
  • 扩展 webContents.setWindowOpenHandler 以支持手动创建 BrowserWindow。 #41432

架构(Stack)更新

Electron 31 将 Chromium 从 114.0.6367.49 升级到 122.. 0.661.39, Node 从 20.11.2 升级到 20.14.0,V8 从 12.4 升级到 12.6

新特性

  • 添加 clearData 方法支 Session. #40983
    • 添加参数到 Session.clearData API。 #41355
  • 添加了对 navigator.serial 中的服务类ID请求的蓝牙端口的支持。 #41638
  • 支持 Node's NODE_EXTRA_CA_CERTS 环境变量. #41689
  • 扩展 webContents.setWindowOpenHandler 以支持手动创建 BrowserWindow。 #41432
  • 实现了对 web 标准 File System API 的支持。 #41419
  • 扩展 WebContentsView 以接受预先存在的 webContents 对象 #42319
  • 在 webContents API 上添加了一个新的实例属性 navigationHistory,配合 navigationHistory.getEntryAtIndex 方法,使应用能够检索浏览历史中任何导航条目的 URL 和标题。 #41577 (Also in 29, 30)

重大更改

移除: WebSQL 的支持

Chromium has removed support for WebSQL upstream, transitioning it to Android only. 更多信息,请阅读 Chromium's 移除意图的讨论

行为变更:nativeImage.toDataURL 将保留 PNG 色彩空间。

PNG 解码器已支持保留颜色空间数据。 从此函数返回的编码数据现在与预期结果匹配。

更多信息,请阅读 crbug.com/332584706

行为变更:win.flashFrame(bool) 将在 macOS 上持续闪烁 Dock 图标。

This brings the behavior to parity with Windows and Linux. 之前的行为:第一次调用 flashFrame(true) 只会使 Dock 图标弹跳一次 (使用 NSInformationalRequest level),调用 flashFrame(false) 不会有任何效果。 现在的行为:持续闪烁,直到调用 flashFrame(false)。 使用了 NSCriticalRequest 级别替换。 如果要明确使用 NSInformationalRequest 使 Dock 图标弹跳一次,仍然可以使用 dock.bounce('informational').

终止对 28.x.y 的支持

根据项目的支持政策,Electron 28.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E31 (24 年 6 月)E26(24 年 8月)E33 (24 年 10 月)
31.x.y32.x.y33.x.y
30.x.y31.x.y32.x.y
28.x.y29.x.y31.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。

Electron 30.0.0

· 阅读时间:约 6 分钟

Electron 30.0.0 已发布! 它包括对 Chromium 124.0.6367.49、V8 12.4 和 Node.js 20.11.1 的升级。


Electron 团队很高兴发布了 Electron 30.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

重点内容

  • Windows 现在支持 ASAR 完整性检查 (#40504)
    • 启用ASAR完整性的现有应用程序如果配置不正确,可能无法在Windows上工作。 使用 Electron 打包工具的应用应该升级到 @electron/packager@18.3.1@electron/forge@7.4.0
    • 查看我们的 ASAR Integrity 教程 以获取更多信息。
  • 添加了 WebContentsViewBaseWindow 主进程模块,废弃并替换 BrowserView (#35658)
    • BrowserView 现在是 WebContentsView 的一个壳,并且旧的实现已被移除。
    • 查看 我们的 Web Embeds 文档 以便将新的 WebContentsView API 和其他类似 API进行比较。
  • 实现了对 File System API 的支持 (#41827)

架构(Stack)更新

Electron 30 将 Chromium 从 122.0.6261.39 升级到 124.0.6367.49, Node 从 20.9.0 升级到 20.11.1 以及 V8 从 12.2 升级到 12.4

新特性

  • 在 webviews 中添加了 transparent 网页偏好设置。 (#40301)
  • 在 webContents API 上添加了一个新的实例属性 navigationHistory,配合 navigationHistory.getEntryAtIndex 方法,使应用能够检索浏览历史中任何导航条目的 URL 和标题。 (#41662)
  • 新增了 BrowserWindow.isOccluded() 方法,允许应用检查窗口是否被遮挡。 (#38982)
  • 为工具进程中 net 模块发出的请求添加了代理配置支持。 (#41417)
  • 添加了对 navigator.serial 中的服务类ID请求的蓝牙端口的支持。 (#41734)
  • 添加了对 Node.js NODE_EXTRA_CA_CERTS 命令行标志的支持。 (#41822)

重大更改

行为变更:跨源 iframe 现在使用 Permission Policy 来访问功能。

跨域 iframe 现在必须通过 allow 属性指定一个给定 iframe 可以访问的功能。

有关更多信息,请参见 文档

移除:--disable-color-correct-rendering 命令行开关

此开关从未正式文档化,但无论如何这里都记录了它的移除。 Chromium 本身现在对颜色空间有更好的支持,因此不再需要该标志。

行为变更:BrowserView.setAutoResize 在 macOS 上的行为

在 Electron 30 中,BrowserView 现在是围绕新的 WebContentsView API 的包装器。

以前,BrowserView API 的 setAutoResize 功能在 macOS 上由 autoresizing 支持,并且在 Windows 和 Linux 上由自定义算法支持。 对于简单的用例,比如使 BrowserView 填充整个窗口,在这两种方法的行为上是相同的。 然而,在更高级的情况下,BrowserViews 在 macOS 上的自动调整大小与在其他平台上的情况不同,因为 Windows 和 Linux 的自定义调整大小算法与 macOS 的自动调整大小 API 的行为并不完全匹配。 自动调整大小的行为现在在所有平台上都标准化了。

如果您的应用使用 BrowserView.setAutoResize 做的不仅仅是使 BrowserView 填满整个窗口,那么您可能已经有了自定义逻辑来处理 macOS 上的这种行为差异。 如果是这样,在 Electron 30 中不再需要这种逻辑,因为自动调整大小的行为是一致的。

移除:WebContentscontext-menuparams.inputFormType 属性

WebContentscontext-menu 事件中 params 对象的 inputFormType 属性已被移除。 请改用新的 formControlType 属性。

移除:process.getIOCounters()

Chromium 已删除对这些信息的访问。

终止对 27.x.y 的支持

根据项目的支持政策,Electron 27.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E30(24 年 4 月)E31 (24 年 6 月)E26(24 年 8月)
30.x.y31.x.y32.x.y
29.x.y30.x.y31.x.y
28.x.y29.x.y30.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。

Electron 29.0.0

· 阅读时间:约 5 分钟

Electron 29.0.0 已发布! 它包括升级 Chromium 122.0.6261.39,和 V8 12.2 以及 Node.js 20.9.2


Electron 团队很高兴发布了 Electron 29.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

重点内容

  • 添加了一个新的顶级 webUtils 模块,这是一个渲染进程模块,提供与 Web API 对象交互的实用程序层。 模块中第一个可用的 API 是 webUtils.getPathForFile。 Electron 以前的 File.path 扩充偏离了网页标准;这个新的 API 更符合当前的 web 标准行为。

架构(Stack)更新

Electron 29 将 Chromium 从 120.0.6099.56 升级到 122..0.661.39, Node 从 18.18.2 升级到 20.9.0,V8 从 12.0 升级到 12.2

新特性

  • 添加了新的 webUtils 模块,一个与 Web API 对象交互的实用程序层,替换 File.path 扩充。 #38776
  • 添加 net 模块到 utility process#40890
  • 添加了一个新的 Electron FusegrantFileProtocolExtravilegesfile:// 协议使其具有更安全和更严格的行为,与 Chromium 相匹配。 #40372
  • protocol.registerSchemesAsseged 中添加了一个选项,以允许自定义协议开启 V8 code cache。 #40544
  • 迁移 app.{set|get}LoginItemSettings(settings) 以便在 MacOS 13.0+ 上使用 Apple 推荐的新底层框架。 #37244

重大更改

行为改变:ipcRenderer 不能再通过 contextBridge 发送

现在通过 contextBridge 传送整个 ipcRenderer 模块作为对象,会在 bridge 的接收方收到一个 空对象。 此更改是为了消除/减轻一种安全隐患。 你不应该直接暴露 bridge 上的 ipcRenderer 或它的方法。 相反,应该提供一个像下面这样的安全包装器:

contextBridge.exposeInMainWorld('app', {
onEvent: (cb) => ipcRenderer.on('foo', (e, ...args) => cb(args)),
});

移除:app 上的 render-process-crashed 事件

The renderer-process-crashed event on app has been removed. 改用新的 render-process-gone 事件。

// 移除
app.on('renderer-process-crashed', (event, webContents, killed) => {
/* ... */
});

// 替换为
app.on('render-process-gone', (event, webContents, details) => {
/* ... */
});

移除:WebContents<webview> 上的 crashed 事件

WebContents<webview> 上的 crashed 事件已被移除。 改用新的 render-process-gone 事件。

// 移除
win.webContents.on('crashed', (event, killed) => {
/* ... */
});
webview.addEventListener('crashed', (event) => {
/* ... */
});

// 替换为
win.webContents.on('render-process-gone', (event, details) => {
/* ... */
});
webview.addEventListener('render-process-gone', (event) => {
/* ... */
});

Removed: gpu-process-crashed event on app

app 上的 gpu-process-crashed 事件已被移除。 使用新的 child-process-gone 事件代替。

// 移除
app.on('gpu-process-crashed', (event, killed) => {
/* ... */
});

// 替换为
app.on('child-process-gone', (event, details) => {
/* ... */
});

终止对 26.x.y 的支持

根据项目的支持政策,Electron 26.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E29(24 年 2 月)E30(24 年 4 月)E31 (24 年 6 月)
29.x.y30.x.y31.x.y
28.x.y29.x.y30.x.y
27.x.y28.x.y29.x.y

接下来

您是否知道 Electron 最近添加了社区征求意见 (RFC) 流程? 如果您想在框架中添加一项功能,RFC 可以成为您与维护者就功能设计展开对话的有用工具。 您还可以查看 PR 中正在讨论的即将发生的更改。 若要了解更多信息,请直接查看我们的 introduction electron/rfcs 博客文章,或查看 electron/rfcs 版本库的 README。

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。

Electron 28.0.0

· 阅读时间:约 5 分钟

Electron 28.0.0 已发布! 它包括升级 Chromium 120.0.6099.56 和 V8 12.0 以及 Node.js 18.18.2


Electron 团队很高兴发布了 Electron 28.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

重点内容

  • 实现了对 ECMAScript 模块或 ESM 的支持(什么是 ECMAScript 模块?) 在这里了解更多信息. 这包括在 Electron 本身中支持 ESM,以及诸如 UtilityProcess API 入口点等方面。 详情见我们的 ESM 文档 以获取更多详细信息。
  • 除了在 Electron 本身中启用 ESM 支持外,Electron Forge 还支持使用 ESM 来打包、构建和开发 Electron 应用程序。 您可以在 Forge v7.0.0 或更高版本中找到这种支持。

架构(Stack)更新

新特性

  • 启用 ESM 支持。 #37535
  • UtilityProcess API 添加了 ESM 入口点。 #40047
  • 添加了几个属性到 display 对象中,包括 detectedmaximumCursorSizenativeOrigin#40554
  • 新增对 Linux 上 ELECTRON_OZONE_PLATFORM_HINT 环境变量的支持。 #39792

重大更改

行为改变:在宿主 BrowserWindow 中将 WebContents.backgroundThrottling 设置为 false 将影响所有的 WebContents

WebContents.backgroundThrottling 设置为 false 将禁用由 BrowserWindow 显示的所有 WebContents 的帧节流。

移除: BrowserWindow.setTrafficLightPosition(position)

已经移除了 BrowserWindow.setTrafficLightPosition(position) 方法,应该改用 BrowserWindow.setWindowButtonPosition(position)方法。新的方法接受 null 作为替换 { x: 0, y: 0 } 的参数,以将位置重置为系统默认值。

// 在 Electron 28 移除
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// 代替为
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

移除: BrowserWindow.getTrafficLightPosition()

已经删除了 BrowserWindow.getTrafficLightPosition(),应该使用 BrowserWindow.getWindowButtonPosition() API 代替,当没有自定义位置时,它返回 null 而不是 { x: 0, y: 0 }

// 在 Electron 28 移除
const pos = win.getTrafficLightPosition();
if (pos.x === 0 && pos.y === 0) {
// 没有自定义位置
}

// 代替为
const ret = win.getWindowButtonPosition();
if (ret === null) {
// 没有自定义位置
}

移除: ipcRenderer.sendTo()

ipcRenderer.sendTo() API 已经被删除。 应该用渲染进程之间的 MessageChannel 来替代它

IpcRendererEventsenderIdsenderIsMainFrame 属性也已经被移除。

移除: app.runningUnderRosettaTranslation

app.runningUnderRosettaTranslation 属性已经被移除。 使用 app.runningUnderARM64Translation 代替.

// 移除
console.log(app.runningUnderRosettaTranslation);
// 代替为
console.log(app.runningUnderARM64Translation);

终止对 25.x.y 的支持

根据项目的支持政策,Electron 25.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E28(23 年 12 月)E29(24 年 2 月)E30(24 年 4 月)
28.x.y29.x.y30.x.y
27.x.y28.x.y29.x.y
26.x.y27.x.y28.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron 的公开时间表

有关这些和未来变化的更多信息可在计划的突破性变化页面找到。

Electron 27.0.0

· 阅读时间:约 5 分钟

Electron 27.0.0 已发布! 此次升级中包含 Chromium 118.0.5993.32,V8 11.8,和 Node.js 18.17.1


Electron 团队很高兴发布了 Electron 27.0.0! 您可以通过 npm install electron@latest 进行安装,或者从我们的 发布网站 下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 TwitterMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的 问题跟踪器 中报告。

重要变化

架构(Stack)更新

重大更改

已移除:macOS 10.13 / 10.14 / 支援

macOS 10.13 (High Serria) 和 macOS 10.14 (Mojave) 不再支援Chromium.

旧版本的 Electron 将继续在这些操作系统上运行,但需要 macOS 10.15 (Catalina) 或更高版本才能运行 Electron v27.0.0 及更高版本。

弃用:ipcRenderer.sendTo()

ipcRenderer.sendTo() 已被弃用。 可以通过在渲染器之间设置一个 MessageChannel 来替换它。

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被弃用。

已删除: systemPreferences 中的 color scheme 相关事件

以下 systemPreferences 事件已被删除:

  • inverted-color-scheme-changed
  • high-contrast-color-scheme-changed

请改用 nativeTheme 模块上的新 updated 事件。

// 已删除
systemPreferences.on('inverted-color-scheme-changed', () => {
/* ... */
});
systemPreferences.on('high-contrast-color-scheme-changed', () => {
/* ... */
});

// 替换为
nativeTheme.on('updated', () => {
/* ... */
});

已删除: webContents.getPrinters

webContents.getPrinters 方法已被删除。 使用webContents.getPrintersAsync代替。

const w = new BrowserWindow({ show: false });

// 已删除
console.log(w.webContents.getPrinters());
// 替换为
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

已删除:systemPreferences.{get,set}AppLevelAppearancesystemPreferences.appLevelAppearance

方法 systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 已被删除,也包括属性 systemPreferences.appLevelAppearance。 请改用模块 nativeTheme

// 已删除
systemPreferences.getAppLevelAppearance();
// 替换为
nativeTheme.shouldUseDarkColors;

// 已删除
systemPreferences.appLevelAppearance;
// 替换为
nativeTheme.shouldUseDarkColors;

// 已删除
systemPreferences.setAppLevelAppearance('dark');
// 替换为
nativeTheme.themeSource = 'dark';

已删除:systemPreferences.getColoralternate-selected-control-text

systemPreferences.getColoralternate-selected-control-text 值已被删除。 替换为 selected-content-background

// 已删除
systemPreferences.getColor('alternate-selected-control-text');
// 替换为
systemPreferences.getColor('selected-content-background');

新特性

  • 添加了应用可访问性透明度设置 API #39631
  • 添加了对 chrome.scripting 扩展 API 的支持 #39675
  • 默认启用 WaylandWindowDecorations #39644

终止对 24.x.y 的支持

根据项目的支持政策,Electron 24.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E27(23 年 10 月)E22 (23 年 12 月)E29(24 年 2 月)
27.x.y28.x.y29.x.y
26.x.y27.x.y28.x.y
25.x.y26.x.y27.x.y

终止对 22.x.y 的支持

今年早些时候,Electron 团队将 Electron 22 的计划生命终止日期从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日,以配合 Chrome 对 Windows 7/8/8.1 的扩展支持(详情请查看 Farewell, Windows 7/8/8.1)。

根据项目的支持政策和此支持扩展,Electron 22.x.y 已经达到了支持的终点。 这将恢复到支持最新的三个稳定的主要版本,并将结束对 Windows 7/8.1 的官方支持。

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron的公开时间表

有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。

Electron 26.0.0

· 阅读时间:约 3 分钟

Electron 26.0.0 已发布! 此次升级中包含 Chromium 116.0.5845.62,V8 11.2,和 Node.js 18.16.1 。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 26.0.0 ! 您可以通过 npm install electron@latest 进行安装,或者从我们的 发布网站 下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在Twitter上与我们分享,或加入我们的社区 Discord! Bug 和功能请求可以在 Electron 的 问题跟踪器 中报告。

重要变化

架构(Stack)更新

重大更改

弃用:webContents.getPrinters

webContents.getPrinters 方法已经被废除。 使用webContents.getPrintersAsync代替。

const w = new BrowserWindow({ show: false });

// 被弃用
console.log(w.webContents.getPrinters());
// 使用它来代替
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

弃用:systemPreferences.{get,set}AppLevelAppearancesystemPreferences.appLevelAppearance

方法systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 已被弃用,也包括属性 systemPreferences.appLevelAppearance。 请改用模块 nativeTheme

// 被弃用
systemPreferences.getAppLevelAppearance();
// 替换为
nativeTheme.shouldUseDarkColors;

// 被弃用
systemPreferences.appLevelAppearance;
// 替换为
nativeTheme.shouldUseDarkColors;

// 被弃用
systemPreferences.setAppLevelAppearance('dark');
// 替换为
nativeTheme.themeSource = 'dark';

弃用:systemPreferences.getColoralternate-selected-control-text

systemPreferences.getColoralternate-selected-control-text 值已被弃用。 替换为 selected-content-background

// 被弃用
systemPreferences.getColor('alternate-selected-control-text');
// 替换为
systemPreferences.getColor('selected-content-background');

新特性

  • 添加了 safeStorage.setUsePlainTextEncryptionsafeStorage.getSelectedStorageBackend api。 #39107
  • 添加了 safeStorage.setUsePlainTextEncryptionsafeStorage.getSelectedStorageBackend api。 #39155
  • senderIsMainFrame添加到通过ipcRenderer.sendTo()发送的消息中。 #39206
  • 添加了由键盘初始化菜单弹出的支持。 #38954

终止对 23.x.y 的支持

根据项目的支持政策,Electron 23.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

E26(23 年 8月)E27(23 年 10 月)E28(24 年 1 月)
26.x.y27.x.y28.x.y
25.x.y26.x.y27.x.y
24.x.y25.x.y26.x.y
22.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron的公开时间表

有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。

Electron 25.0.0

· 阅读时间:约 6 分钟

Electron 25.0.0 已发布! 此次升级中包含 Chromium 114,V8 11.4,和 Node.js 18.15.0 。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 25.0.0 ! 您可以通过 npm install electron@latest 进行安装,或者从我们的 发布网站 下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在Twitter上与我们分享,或加入我们的社区 Discord! Bug 和功能请求可以在 Electron 的 问题跟踪器 中报告。

重要变化

重点内容

  • 使用 Chromium 的网络栈在 Electron 的 net 模块中实现了 net.fetch。 和 Node 的 fetch() 不同的是后者使用了 Node.js 的 HTTP 栈。 请参阅 #36733#36606
  • 添加了 protocol.handle,它取代并弃用了 protocol.{register,intercept}{String,Buffer,Stream,Http,File}Protocol#36674
  • 增加了对 Electron 22 的支持,以配合 Chromium 和 Microsoft 的 Windows 7/8/8.1 弃用计划。 请参阅本博文末尾的更多详细信息。

架构(Stack)更新

重大更改

弃用:protocol.{register,intercept}{Buffer,String,Stream,File,Http}Protocol

protocol.register***Protocolprotocol.intercept***Protocol 方法 已替换为 protocol.handle

新方法可以注册新协议或拦截现有协议 协议和响应可以是任何类型。

// 在 Electron 25 中弃用
protocol.registerBufferProtocol('some-protocol', () => {
callback({ mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>') });
});

// 用以代替
protocol.handle('some-protocol', () => {
return new Response(
Buffer.from('<h5>Response</h5>'), // 也可以是 string 或 ReadableStream.
{ headers: { 'content-type': 'text/html' } }
);
});
// 在 Electron 25 中弃用
protocol.registerHttpProtocol('some-protocol', () => {
callback({ url: 'https://electronjs.org' });
});

// 用以代替
protocol.handle('some-protocol', () => {
return net.fetch('https://electronjs.org');
});
// 在 Electron 25 中弃用
protocol.registerFileProtocol('some-protocol', () => {
callback({ filePath: '/path/to/my/file' });
});

// 用以代替
protocol.handle('some-protocol', () => {
return net.fetch('file:///path/to/my/file');
});

弃用:BrowserWindow.setTrafficLightPosition(position)

BrowserWindow.setTrafficLightPosition(position) 已弃用,应使用 BrowserWindow.setWindowButtonPosition(position) API,它接受 null 而不是 { x: 0, y: 0 } 将位置重置为系统默认值。

// 在 Electron 25 中弃用
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// 用以代替
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

弃用:BrowserWindow.getTrafficLightPosition()

BrowserWindow.getTrafficLightPosition() 已弃用,应使用 BrowserWindow.getWindowButtonPosition() API,当没有自定义位置时,它返回 null 而不是 { x: 0, y: 0 }

// Deprecated in Electron 25
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.
}

新特性

  • 已添加 net.fetch()#36733
    • net.fetch 支持对 file: URL 和使用 protocol.register*Protocol 注册的自定义协议的请求。 #36606
  • 添加了 BrowserWindow.set/getWindowButtonPosition API。 #37094
  • 添加了protocol.handle,替换并弃用了protocol.{register,intercept}{String,Buffer,Stream,Http,File}Protocol#36674
  • webContents<webview> 标签添加了一个 will-frame-navigate 事件,每当 frame 层中的任何一个 frame 调用 navigate 时,都会触发该函数。 #34418
  • 向 navigator 事件添加了启动信息。 这个信息允许区分来自父框架 window.open 引起的 navigation 事件,而不是来自子框架发起的 navigation 事件。 #37085
  • 增加了 net.resolveHost,它使用 defaultSession 对象来解析 hosts。 #38152
  • app 添加了新的 'did-resign-active' 事件。 #38018
  • webContents.print() 添加了几个标准页面大小选项。 #37159
  • 向会话处理程序 ses.setDisplayMediaRequestHandler() 的回调中添加了 enableLocalEcho 标志,以允许当 audioWebFrameMain 时在本地输出流中回显远程音频输入。 #37315
  • powerMonitor 添加了 thermal 信息管理。 #38028
  • 允许将绝对路径传递给 session.fromPath() API。 #37604
  • webContents 上公开 audio-state-changed 事件。 #37366

22.x.y 持续支持

正如再见 Windows 7/8/8.1 所述,Electron 22(Chromium 108)的计划寿命终止日期将从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日。 Electron 团队将会继续向 Electron 22 提供本计划中的任何安全修复,直到 2023 年 10 月 10 日。 十月 支持日期遵循 Chromium 和 Microsoft 的延长支持日期。 10 月 11 日,Electron 团队将支持回退到最新的三个稳定主要版本,将不再支持 Windows 7/8/8.1。

E25(23 年 5 月)E26(23 年 8月)E27(23 年 10 月)
25.x.y26.x.y27.x.y
24.x.y25.x.y26.x.y
23.x.y24.x.y25.x.y
22.x.y22.x.y--

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron的公开时间表

有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。

Electron 24.0.0

· 阅读时间:约 5 分钟

Electron 24.0.0 已发布! 此次升级中包含 Chromium 112.0.5615.49,V8 11.2,和 Node.js 18.14.0 。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 24.0.0 ! 您可以通过 npm install electron@latest 进行安装,或者从我们的 发布网站 下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在Twitter上与我们分享,或加入我们的社区 Discord! Bug 和功能请求可以在 Electron 的 问题跟踪器 中报告。

重要变化

架构(Stack)更新

重大更改

API Changed: nativeImage.createThumbnailFromPath(path, size)

maxSize 参数已更改为 size 以反映传入的大小将是创建的缩略图的大小。 以前,如果图像小于 maxSize,Windows 不会放大图像,而 macOS 总会将大小设置为 maxSize。 现在跨平台的行为是相同的。

// 一张 128x128 的图片。
const imagePath = path.join('path', 'to', 'capybara.png');

// 放大较小的图像。
const upSize = { width: 256, height: 256 };
nativeImage.createThumbnailFromPath(imagePath, upSize).then((result) => {
console.log(result.getSize()); // { width: 256, height: 256 }
});

// 缩小更大的图像。
const downSize = { width: 64, height: 64 };
nativeImage.createThumbnailFromPath(imagePath, downSize).then((result) => {
console.log(result.getSize()); // { width: 64, height: 64 }
});

新特性

  • 添加了使用 cookies.get() 过滤 cookie 中 HttpOnly 的功能。 #37365
  • logUsage 添加到 shell.openExternal() 参数中,以允许将 SEE_MASK_FLAG_LOG_USAGE 标志传递给 Windows 上的 ShellExecuteExSEE_MASK_FLAG_LOG_USAGE 标志表示用户发起启动,可以跟踪常用程序和其他行为。 #37291
  • webRequest 过滤器添加了 types,添加了过滤监听请求的能力。#37427
  • webContents 添加了一个新的 devtools-open-url 事件,以允许开发人员使用它们打开新窗口。 #36774
  • webContents.print() 添加了几个标准页面大小选项。 #37265
  • 向会话处理程序 ses.setDisplayMediaRequestHandler() 的回调中添加了 enableLocalEcho 标志,以允许当 audioWebFrameMain 时在本地输出流中回显远程音频输入。 #37528
  • 允许向 inAppPurchase.purchaseProduct() 传递一个特定于应用程序的用户名。 #35902
  • 公开了window.invalidateShadow(),以清除macOS上残留的视觉伪影。 #32452
  • 整个程序优化现在在 Electron headers 配置文件中默认启用,允许编译器利用程序中所有模块的信息进行优化,而不是以每个模块 (compiland) 为基础。 #36937
  • SystemPreferences::CanPromptTouchID (macOS) 现在支持Apple Watch。 #36935

终止对 21.x.y 的支持

根据项目的支持政策,Electron 21.x.y 已经达到了支持的终点。 我们鼓励开发者将应用程序升级到更新的 Electron 版本。

As noted in Farewell, Windows 7/8/8.1, Electron 22's (Chromium 108) planned end of life date will be extended from May 30, 2023 to October 10, 2023. The Electron team will continue to backport any security fixes that are part of this program to Electron 22 until October 10, 2023.

E24(23 年 4 月)E25(23 年 5 月)E26(23 年 8月)
24.x.y25.x.y26.x.y
23.x.y24.x.y25.x.y
22.x.y23.x.y24.x.y
--22.x.y22.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron的公开时间表

有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。

Electron 23.0.0

· 阅读时间:约 4 分钟

Electron 23.0.0 已发布! 此次升级中包含 Chromium 110, V8 11.0, 和 Node.js 18.12.1。 此外,取消了对Windows 7/8.1的支持。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 23.0.0! 您可以通过 npm install electron@latest 进行安装,或者从我们的 发布网站 下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在Twitter上与我们分享,或加入我们的社区 Discord! Bug 和功能请求可以在 Electron 的 问题跟踪器 中报告。

重要变化

架构(Stack)更新

新特性

  • label 属性添加到 Display 对象上。 #36933
  • 添加了 app.getPreferredSystemLanguages() API 以返回用户的系统语言。 #36035
  • 添加了对 WebUSB API 的支持。 #36289
  • 添加了对 SerialPort.forget() 的支持,以及当给定来源被撤销时在 Session 对象上发出的新事件 serial-port-revoked#35310
  • 添加了新的 win.setHiddenInMissionControl API 以允许开发者选择退出 macOS 上的任务控制。 #36092

放弃对 Windows 7/8.1 支持

Electron 23 不再支持 Windows 7/8.1。 Electron 遵循计划中的 Chromium 弃用政策,该政策将 在 Chromium 109 中弃用 Windows 7/8/8.1 支持(在此处阅读更多信息)

重要的API变更

以下是 Electron 23 中引入的破坏性变更。 您可以在 Planned Breaking Changes 页面上阅读有关这些更改和未来更改的更多信息。

已删除:BrowserWindow scroll-touch-* 事件

在 BrowserWindow 上已弃用的 scroll-touch-beginscroll-touch-endscroll-touch-edge 事件已被移除。 与此同时,可在 WebContents 上使用最新可用的 input-event 事件。

// Removed in Electron 23.0
-win.on('scroll-touch-begin', scrollTouchBegin)
-win.on('scroll-touch-edge', scrollTouchEdge)
-win.on('scroll-touch-end', scrollTouchEnd)

// Replace with
+win.webContents.on('input-event', (_, event) => {
+ if (event.type === 'gestureScrollBegin') {
+ scrollTouchBegin()
+ } else if (event.type === 'gestureScrollUpdate') +{
+ scrollTouchEdge()
+ } else if (event.type === 'gestureScrollEnd') {
+ scrollTouchEnd()
+ }
+})

终止对 20.x.y 的支持

根据项目的支持政策,Electron 20.x.y 已经达到了支持的终点。 我们鼓励开发者和应用程序升级到最新的 Electron 版本。

E22(22 年 11 月)E23(23 年 1 月)E24(23 年 4 月)E25(23 年 5 月)E26(23 年 8月)
22.x.y23.x.y24.x.y25.x.y26.x.y
21.x.y22.x.y23.x.y24.x.y25.x.y
20.x.y21.x.y22.x.y23.x.y24.x.y

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。

您可以在此处找到 Electron的公开时间表

有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。