跳转到主要内容

47 条带有“Release”标签的帖子

关于 Electron 新发布的博客文章

查看所有标签

Electron 29.0.0

·阅读时长 5 分钟

Electron 29.0.0 已发布!它包含了 Chromium 122.0.6261.39、V8 12.2 和 Node.js 20.9.0 的升级。


Electron 团队很高兴地宣布 Electron 29.0.0 发布! 您可以通过 npm install electron@latest 使用 npm 安装,或从我们的发布网站下载。 请继续阅读以了解此版本的详细信息。

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

重要变更

亮点

  • 新增了一个顶层 webUtils 模块,这是一个渲染器进程模块,提供了一个实用工具层来与 Web API 对象进行交互。该模块中可用的第一个 API 是 webUtils.getPathForFile。Electron 之前对 File.path 的增强偏离了 Web 标准;这个新的 API 更符合当前的 Web 标准行为。

技术栈变更

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 模块添加到 utility process#40890
  • 新增了一个 Electron FusegrantFileProtocolExtraPrivileges,它使 file:// 协议具有更安全、更严格的行为,与 Chromium 匹配。#40372
  • protocol.registerSchemesAsPrivileged 中添加了一个选项,允许在自定义方案中使用 V8 代码缓存。 #40544
  • 在 macOS 13.0+ 上,已将 app.{set|get}LoginItemSettings(settings) 迁移到使用 Apple 新推荐的底层框架。 #37244

破坏性变更

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

现在,尝试通过 contextBridge 将整个 ipcRenderer 模块作为对象发送将导致桥的接收端出现一个空对象。此更改是为了消除/缓解安全隐患。您不应该直接通过桥暴露 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 (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 可以是与维护者就其设计展开对话的有用工具。您还可以在拉取请求中查看正在讨论的即将进行的更改。要了解更多信息,请查看我们的介绍 electron/rfcs 博客文章,或直接查看 electron/rfcs 存储库的 README。

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

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

有关未来变更的更多信息,请参阅计划中的破坏性变更页面。

Electron 28.0.0

·阅读时长 4 分钟

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 使用 npm 进行安装,或从我们的 发布网站 下载。请继续阅读以了解此版本详情。

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

重要变更

亮点

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

技术栈变更

新特性

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

破坏性变更

行为变更:将 WebContents.backgroundThrottling 设置为 false 会影响主机 BrowserWindow 中的所有 WebContents

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

移除:BrowserWindow.setTrafficLightPosition(position)

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

// Removed in Electron 28
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

移除:BrowserWindow.getTrafficLightPosition()

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

// Removed in Electron 28
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.
}

已移除: ipcRenderer.sendTo()

已移除 ipcRenderer.sendTo() API。应通过在渲染器之间设置 MessageChannel 来替代它。

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被移除。

移除:app.runningUnderRosettaTranslation

app.runningUnderRosettaTranslation 属性已被移除。 请改用 app.runningUnderARM64Translation

// Removed
console.log(app.runningUnderRosettaTranslation);
// Replace with
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

·阅读时长 4 分钟

Electron 27.0.0 现已发布! 它包括对 Chromium 118.0.5993.32、V8 11.8 和 Node.js 18.17.1 的升级。


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

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

重要变更

技术栈变更

破坏性变更

已移除:对 macOS 10.13 / 10.14 的支持

Chromium 不再支持 macOS 10.13 (High Sierra) 和 macOS 10.14 (Mojave)。

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

已弃用:ipcRenderer.sendTo()

ipcRenderer.sendTo() API 已被弃用。 它应该被替换为在渲染器之间设置一个 MessageChannel

IpcRendererEventsenderIdsenderIsMainFrame 属性也已被弃用。

已移除:systemPreferences 中的配色方案事件

以下 systemPreferences 事件已被移除:

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

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

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

// Replace with
nativeTheme.on('updated', () => {
/* ... */
});

已移除:webContents.getPrinters

webContents.getPrinters 方法已被移除。 请改用 webContents.getPrintersAsync

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

// Removed
console.log(w.webContents.getPrinters());
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

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

systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 方法以及 systemPreferences.appLevelAppearance 属性已移除。 请改用 nativeTheme 模块。

// Removed
systemPreferences.getAppLevelAppearance();
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.appLevelAppearance;
// Replace with
nativeTheme.shouldUseDarkColors;

// Removed
systemPreferences.setAppLevelAppearance('dark');
// Replace with
nativeTheme.themeSource = 'dark';

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

systemPreferences.getColoralternate-selected-control-text 值已被移除。 请改用 selected-content-background

// Removed
systemPreferences.getColor('alternate-selected-control-text');
// Replace with
systemPreferences.getColor('selected-content-background');

新特性

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

终止对 24.x.y 的支持

根据项目的支持策略,Electron 24.x.y 已达到支持结束。 建议开发者和应用程序升级到较新版本的 Electron。

E27 (23年10月)E28 (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 的扩展支持(详情请参阅告别,Windows 7/8/8.1)。

根据项目的支持策略和本次支持扩展,Electron 22.x.y 已达到支持结束。 这将把支持回退到最新的三个稳定主版本,并将结束对 Windows 7/8/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 使用 npm 进行安装,或者从我们的 发布网站 下载。请继续阅读以了解此版本的详细信息。

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

重要变更

技术栈变更

破坏性变更

已废弃:webContents.getPrinters

webContents.getPrinters 方法已被废弃。 请改用 webContents.getPrintersAsync

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

// Deprecated
console.log(w.webContents.getPrinters());
// Replace with
w.webContents.getPrintersAsync().then((printers) => {
console.log(printers);
});

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

systemPreferences.getAppLevelAppearancesystemPreferences.setAppLevelAppearance 方法以及 systemPreferences.appLevelAppearance 属性已被弃用。请改用 nativeTheme 模块。

// Deprecated
systemPreferences.getAppLevelAppearance();
// Replace with
nativeTheme.shouldUseDarkColors;

// Deprecated
systemPreferences.appLevelAppearance;
// Replace with
nativeTheme.shouldUseDarkColors;

// Deprecated
systemPreferences.setAppLevelAppearance('dark');
// Replace with
nativeTheme.themeSource = 'dark';

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

systemPreferences.getColoralternate-selected-control-text 值已被废弃。 请改用 selected-content-background

// Deprecated
systemPreferences.getColor('alternate-selected-control-text');
// Replace with
systemPreferences.getColor('selected-content-background');

新特性

  • 添加了 safeStorage.setUsePlainTextEncryptionsafeStorage.getSelectedStorageBackend API。 #39107
  • 添加了 safeStorage.setUsePlainTextEncryptionsafeStorage.getSelectedStorageBackend API。 #39155
  • 为通过 ipcRenderer.sendTo() 发送的消息添加了 senderIsMainFrame#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

·阅读时长 5 分钟

Electron 25.0.0 已经发布! 它包括对 Chromium 114、V8 11.4 和 Node.js 18.15.0 的升级。 请继续阅读以了解更多详情!


Electron 团队很高兴地宣布 Electron 25.0.0 的发布!您可以通过 npm install electron@latest 使用 npm 进行安装,或从我们的 发布网站 下载。请继续阅读以了解此次发布详情。

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

重要变更

亮点

  • 在 Electron 的 net 模块中实现了 net.fetch,使用了 Chromium 的网络堆栈。这与 Node 的 fetch() 不同,Node 的 fetch() 使用的是 Node.js 的 HTTP 堆栈。请参阅 #36733#36606
  • 添加了 protocol.handle,该方法将替换并弃用 protocol.{register,intercept}{String,Buffer,Stream,Http,File}Protocol#36674
  • 扩展了对 Electron 22 的支持,以匹配 Chromium 和微软对 Windows 7/8/8.1 的废弃计划。 请参阅本篇博文末尾的更多细节。

技术栈变更

破坏性变更

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

protocol.register*Protocolprotocol.intercept*Protocol 方法已被 protocol.handle 替代。

新方法既可以注册一个新协议,也可以拦截一个现有协议,并且响应可以是任何类型。

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

// Replace with
protocol.handle('some-protocol', () => {
return new Response(
Buffer.from('<h5>Response</h5>'), // Could also be a string or ReadableStream.
{ headers: { 'content-type': 'text/html' } },
);
});
// Deprecated in Electron 25
protocol.registerHttpProtocol('some-protocol', () => {
callback({ url: 'https://electron.js.cn' });
});

// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('https://electron.js.cn');
});
// Deprecated in Electron 25
protocol.registerFileProtocol('some-protocol', () => {
callback({ filePath: '/path/to/my/file' });
});

// Replace with
protocol.handle('some-protocol', () => {
return net.fetch('file:///path/to/my/file');
});

已弃用:BrowserWindow.setTrafficLightPosition(position)

BrowserWindow.setTrafficLightPosition(position) 已被弃用,应改用 BrowserWindow.setWindowButtonPosition(position) API,该 API 接受 null 而非 { x: 0, y: 0 } 来将位置重置为系统默认值。

// Deprecated in Electron 25
win.setTrafficLightPosition({ x: 10, y: 10 });
win.setTrafficLightPosition({ x: 0, y: 0 });

// Replace with
win.setWindowButtonPosition({ x: 10, y: 10 });
win.setWindowButtonPosition(null);

已弃用:BrowserWindow.getTrafficLightPosition()

BrowserWindow.getTrafficLightPosition() 已被弃用,应改用 BrowserWindow.getWindowButtonPosition() API,该 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 事件,该事件会在框架层次结构中的任何框架尝试导航时触发。#34418
  • 向 navigator 事件添加了发起者信息。此信息允许区分由父框架引起的 window.open 导航与子级发起的导航。#37085
  • 添加了 net.resolveHost,它使用 defaultSession 对象解析主机。 #38152
  • app 添加了新的 'did-resign-active' 事件。 #38018
  • webContents.print() 添加了几个标准的页面尺寸选项。 #37159
  • 为会话处理程序 ses.setDisplayMediaRequestHandler() 回调添加了 enableLocalEcho 标志,允许在 audioWebFrameMain 时,将远程音频输入回显到本地输出流。#37315
  • powerMonitor 添加了热管理信息。 #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 日。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

·阅读时长 4 分钟

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 使用 npm 安装它,或者从我们的发布网站下载。请继续阅读以获取有关此版本的详细信息。

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

重要变更

技术栈变更

破坏性变更

API 变更:nativeImage.createThumbnailFromPath(path, size)

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

// a 128x128 image.
const imagePath = path.join('path', 'to', 'capybara.png');

// Scaling up a smaller image.
const upSize = { width: 256, height: 256 };
nativeImage.createThumbnailFromPath(imagePath, upSize).then((result) => {
console.log(result.getSize()); // { width: 256, height: 256 }
});

// Scaling down a larger image.
const downSize = { width: 64, height: 64 };
nativeImage.createThumbnailFromPath(imagePath, downSize).then((result) => {
console.log(result.getSize()); // { width: 64, height: 64 }
});

新特性

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

停止支持 21.x.y

根据项目的支持政策,Electron 21.x.y 已达到支持结束。建议开发者和应用程序升级到更新的 Electron 版本。

正如在告别 Windows 7/8/8.1 中提到的,Electron 22 (Chromium 108) 计划的生命周期结束日期将从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日。Electron 团队将继续将此计划中的任何安全修复程序向后移植到 Electron 22,直到 2023 年 10 月 10 日。

E24 (2023 年 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/8.1 的支持已被移除。请继续阅读以获取更多详细信息!


Electron 团队激动地宣布 Electron 23.0.0 发布!您可以通过 npm install electron@latest 使用 npm 安装,或从我们的 发布网站 下载。请继续阅读以了解此次发布的详细信息。

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

重要变更

技术栈变更

新特性

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

停止支持 Windows 7/8/8.1

Electron 23 不再支持 Windows 7/8/8.1。Electron 遵循 Chromium 的计划弃用策略,该策略将在 Chromium 109 中 弃用 Windows 7/8/8.1 以及 Windows Server 2012 和 2012 R2 的支持(在此处阅读更多)

破坏性 API 变更

以下是 Electron 23 中引入的重大更改。您可以在 计划的重大更改 页面上阅读有关这些更改和未来更改的更多信息。

已移除: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 (2023年2月)E24 (2023 年 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 的公开时间线

有关未来变更的更多信息,请参阅计划中的破坏性变更页面。

Electron 22.0.0

·6 分钟阅读

Electron 22.0.0 已经发布! 它包括一个新的实用工具进程 API,对 Windows 7/8/8.1 支持的更新,以及对 Chromium 108, V8 10.8, 和 Node.js 16.17.1 的升级。 请继续阅读以了解更多详情!


Electron 团队很高兴地宣布 Electron 22.0.0 的发布!您可以使用 npm install electron@latest 通过 npm 进行安装,或从我们的发布网站下载。请继续阅读以了解此版本详情。

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

重要变更

技术栈变更

亮点功能

UtilityProcess API #36089

新的 UtilityProcess 主进程模块允许创建一个轻量级的 Chromium 子进程,该子进程仅包含 Node.js 集成,同时允许使用 MessageChannel 与沙盒化的渲染器进行通信。该 API 的设计基于 Node.js 的 child_process.fork,以便于迁移,其主要区别在于入口点 modulePath 必须位于打包应用程序内部,以便只加载受信任的脚本。此外,该模块默认阻止与渲染器建立通信通道,以维护主进程是应用程序中唯一受信任进程的约定。

您可以在我们的文档中阅读有关新的 UtilityProcess API 的更多信息

Windows 7/8/8.1 支持更新

信息

2023/02/16:关于 Windows Server 2012 支持的更新

上个月,Google 宣布 Chrome 109 将继续接收 Windows Server 2012 和 Windows Server 2012 R2 的关键安全修复程序,直至 2023 年 10 月 10 日。因此,Electron 22(Chromium 108)的计划生命周期结束日期将从 2023 年 5 月 30 日延长至 2023 年 10 月 10 日。Electron 团队将继续将此计划中的任何安全修复程序向后移植到 Electron 22,直至 2023 年 10 月 10 日。

请注意,我们不会为 Windows 7/8/8.1 提供额外的安全修复。此外,如先前宣布,Electron 23 (Chromium 110) 将只在 Windows 10 及以上版本运行。

Electron 22 将是最后一个支持 Windows 7/8/8.1 的 Electron 主要版本。Electron 遵循 Chromium 的计划弃用策略,该策略将在Chromium 109 中弃用对 Windows 7/8/8.1 的支持(点击此处了解更多)

Electron 23 及更高版本将不再支持 Windows 7/8/8.1。

其他亮点变更

  • 增加了对 Linux 和 Windows 上 Web Bluetooth PIN 配对的支持。#35416
  • 添加了 LoadBrowserProcessSpecificV8Snapshot 作为一项新的 fuse,它允许主进程/浏览器进程从 browser_v8_context_snapshot.bin 文件加载其 v8 快照。任何其他进程将使用今天使用的相同路径。#35266
  • 添加了 WebContents.opener 以访问窗口打开程序,以及 webContents.fromFrame(frame) 以获取与 WebFrameMain 实例对应的 WebContents。#35140
  • 通过一个新的会话处理程序 ses.setDisplayMediaRequestHandler,增加了对 navigator.mediaDevices.getDisplayMedia 的支持。#30702

破坏性 API 变更

以下是 Electron 22 中引入的重大更改。您可以在计划的重大更改页面上了解更多关于这些更改和未来更改的信息。

已弃用:webContents.incrementCapturerCount(stayHidden, stayAwake)

webContents.incrementCapturerCount(stayHidden, stayAwake) 已被弃用。 现在当页面捕获完成时,它由 webContents.capturePage 自动处理。

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

- w.webContents.incrementCapturerCount()
- w.capturePage().then(image => {
- console.log(image.toDataURL())
- w.webContents.decrementCapturerCount()
- })

+ w.capturePage().then(image => {
+ console.log(image.toDataURL())
+ })

已弃用:webContents.decrementCapturerCount(stayHidden, stayAwake)

webContents.decrementCapturerCount(stayHidden, stayAwake) 已被弃用。 现在当页面捕获完成时,它由 webContents.capturePage 自动处理。

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

- w.webContents.incrementCapturerCount()
- w.capturePage().then(image => {
- console.log(image.toDataURL())
- w.webContents.decrementCapturerCount()
- })

+ w.capturePage().then(image => {
+ console.log(image.toDataURL())
+ })

已移除: WebContents 的 new-window 事件

WebContents 的 new-window 事件已被移除。它已被 webContents.setWindowOpenHandler() 取代。

- webContents.on('new-window', (event) => {
- event.preventDefault()
- })

+ webContents.setWindowOpenHandler((details) => {
+ return { action: 'deny' }
+ })

已弃用:BrowserWindow scroll-touch-* 事件

BrowserWindow 上的 scroll-touch-beginscroll-touch-endscroll-touch-edge 事件已被弃用。现在,请使用 WebContents 上新提供的 input-event 事件

// Deprecated
- 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()
+ }
+ })

19.x.y 版本支持结束

根据项目的支持策略,Electron 19.x.y 已结束支持。建议开发人员和应用程序升级到新版本的 Electron。

E19 (22年5月)E20 (22年8月)E21 (22年9月)E22 (22年11月)E23 (23年1月)
19.x.y20.x.y21.x.y22.x.y23.x.y
18.x.y19.x.y20.x.y21.x.y22.x.y
17.x.y18.x.y19.x.y20.x.y21.x.y

下一步计划

Electron 项目将在 2022 年 12 月暂停,并于 2023 年 1 月恢复。您可以在十二月停工博客文章中找到更多信息。

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

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

有关未来变更的更多信息,请参阅计划中的破坏性变更页面。

Electron 21.0.0

·3 分钟阅读

Electron 21.0.0 已发布! 它包括升级到 Chromium 106、V8 10.6 和 Node.js 16.16.0。 阅读下文了解更多详情!


Electron 团队很高兴地宣布发布 Electron 21.0.0!您可以通过 npm install electron@latest 命令使用 npm 安装它,或者从我们的发布网站下载。请继续阅读以了解此版本的详细信息。

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

重要变更

技术栈变更

新特性

  • 添加了 webFrameMain.origin#35534
  • 添加了新的 WebContents.ipcWebFrameMain.ipc API。#35231
  • 添加了对面板式行为的支持。 窗口可以浮动在全屏应用程序之上。#34388
  • 添加了对 macOS 应用程序来自 APNs 的推送通知的支持。#33574

破坏性与 API 变更

以下是 Electron 21 中引入的重大变更。

V8 内存笼已启用

Electron 21 启用了V8 沙箱指针,遵循 Chrome 在Chrome 103 中做出相同决定的做法。这会对原生模块产生一些影响。此功能具有性能和安全优势,但同时也对原生模块施加了一些新的限制,例如使用指向外部(“堆外”)内存的 ArrayBuffers。请参阅这篇博文了解更多信息。#34724

重构了 webContents.printToPDF

重构了 webContents.printToPDF 以与 Chromium 的无头实现保持一致。 有关更多信息,请参阅#33654

有关这些和未来更改的更多信息,请访问计划中的重大更改页面。

停止支持 18.x.y

根据项目的支持策略,Electron 18.x.y 已停止支持。鼓励开发者和应用程序升级到更新版本的 Electron。

E18 (22年3月)E19 (22年5月)E20 (22年8月)E21 (22年9月)E22 (22年12月)
18.x.y19.x.y20.x.y21.x.y22.x.y
17.x.y18.x.y19.x.y20.x.y21.x.y
16.x.y17.x.y18.x.y19.x.y20.x.y

下一步计划

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

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

有关未来变更的更多信息,请参阅计划中的破坏性变更页面。

Electron 20.0.0

2022年8月2日 ·阅读时长 4 分钟

Electron 20.0.0 现已发布!此版本升级到了 Chromium 104、V8 10.4 和 Node.js 16.15.0。请阅读下文了解更多详情!


Electron 团队很高兴地宣布 Electron 20.0.0 的发布!您可以通过 npm install electron@latest 使用 npm 进行安装,或从我们的 发布网站 下载。请继续阅读以了解此版本详情,并请分享您的任何反馈!

重要变更

新特性

  • 在 Windows 上增加了沉浸式暗黑模式。#34549
  • 增加了对类似面板行为的支持。窗口可以浮动在全屏应用程序之上。#34665
  • 更新了 Windows 控件覆盖按钮,使其在 Windows 11 上的外观和感觉更原生。#34888
  • 除非指定了 nodeIntegration: truesandbox: false,否则渲染器现在默认是沙盒化的。#35125
  • 在使用 nan 构建原生模块时增加了安全保障。#35160

技术栈变更

破坏性与 API 变更

以下是 Electron 20 中引入的破坏性变更。有关这些变更及未来变更的更多信息,请参阅 计划中的破坏性变更 页面。

默认更改:没有 nodeIntegration: true 的渲染器默认已沙盒化

以前,指定了预加载脚本的渲染器默认未沙盒化。这意味着默认情况下,预加载脚本可以访问 Node.js。在 Electron 20 中,此默认设置已更改。从 Electron 20 开始,除非指定了 nodeIntegration: truesandbox: false,否则渲染器默认将已沙盒化。

如果您的预加载脚本不依赖于 Node,则无需任何操作。如果您的预加载脚本确实依赖于 Node,那么要么重构它们以从渲染器中移除 Node 的使用,要么为相关渲染器明确指定 sandbox: false

已修复:nan 原生模块中的自发崩溃

在 Electron 20 中,我们更改了两个与原生模块相关的项目:

  1. V8 头文件现在默认使用 c++17。这个标志已添加到 electron-rebuild 中。
  2. 我们修复了一个问题,即一个缺失的 include 会导致依赖 nan 的原生模块发生自发性崩溃。

为获得最佳稳定性,我们建议在重新构建原生模块(尤其是依赖 nan 的模块)时使用 node-gyp >=8.4.0 和 electron-rebuild >=3.2.9。有关更多信息,请参阅 electron #35160 和 node-gyp #2497

已移除:Linux 上的 .skipTaskbar

在 X11 上,skipTaskbar 会向 X11 窗口管理器发送一个 _NET_WM_STATE_SKIP_TASKBAR 消息。Wayland 没有直接的等效项,并且已知的解决方法存在不可接受的权衡(例如,GNOME 中的 Window.is_skip_taskbar 需要不安全模式),因此 Electron 无法在 Linux 上支持此功能。

终止对 17.x.y 的支持

根据项目的 支持策略,Electron 17.x.y 已停止支持。我们鼓励开发者和应用程序升级到更新版本的 Electron。

E18 (22年3月)E19 (22年5月)E20 (22年8月)E21 (22年9月)E22 (22年12月)
18.x.y19.x.y20.x.y21.x.y22.x.y
17.x.y18.x.y19.x.y20.x.y21.x.y
16.x.y17.x.y18.x.y19.x.y20.x.y
15.x.y--------

下一步计划

短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。 尽管我们谨慎地不承诺发布日期,但我们的计划是大约每 2 个月发布包含这些组件新版本的新 Electron 主要版本。

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

有关未来变更的更多信息,请参阅计划中的破坏性变更页面。