跳转到主内容

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

查看所有标签

Electron 35.0.0

· 阅读时间:约 7 分钟

Electron 35.0.0 已发布!它包括对 Chromium 134.0.6998.44、V8 13.5 和 Node 22.14.0 的升级。


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

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

重要变化​

用于改进扩展支持的 Service Worker 预加载脚本​

最初由 @samuelmaddock 在 RFC #8 中提出,Electron 35 添加了将预加载脚本附加到 Service Workers 的功能。由于 Chrome 的 Manifest V3 Extensions 通过 扩展 service workers 处理大量工作,该功能填补了 Electron 对现代 Chrome 扩展程序支持的空白。

在会话级别以编程方式注册预加载脚本时,现在可以使用 ses.registerPreloadScript(script) API 将其专门应用于 Service Worker 上下文。

Main Process
// 将我们的预加载脚本添加到会话中。
session.defaultSession.registerPreloadScript({
// 我们的脚本应该只在 service worker 预加载中运行。
type: 'service-worker',
// 脚本的绝对路径。
script: path.join(__dirname, 'extension-sw-preload.js'),
});;

此外,现在可以通过 ServiceWorkerMain.ipc 类在 Service Workers 及其附加的预加载脚本之间进行 IPC 通信。预加载脚本仍将使用 ipcRenderer 模块与其 Service Worker 进行通信。请参阅原始 RFC 以了解更多详细信息。

此功能之前已经进行了许多其他更改,为其奠定了基础:

  • #45329 重新设计了 Session 模块的预加载 API,以支持注册和取消注册单独的预加载脚本。
  • #45229 添加了实验性的 contextBridge.executeInMainWorld(executionScript) 脚本,用于通过 context bridge 在 main world 中执行 JavaScript。
  • #45341 添加了 ServiceWorkerMain 类,用于与主进程中的 Service Workers 交互。

Electron 34.0.0

· 阅读时间:约 4 分钟

Electron 34.0.0 已发布!它包括对 Chromium 132.0.6834.83、V8 13.2 和 Node 20.18.1 的升级。


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

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

重要变化​

HTTP Compression Shared Dictionary Management APIs​

HTTP compression allows data to be compressed by a web server before being received by the browser. Modern versions of Chromium support Brotli and Zstandard, which are newer compression algorithms that perform better for text files than older schemes such as gzip.

Custom shared dictionaries further improve the efficiency of Brotli and Zstandard compression. See the Chrome for Developers blog on shared dictionaries for more information.

@felixrieseberg added the following APIs in #44950 to manage shared dictionaries at the Session level:

  • session.getSharedDictionaryUsageInfo()
  • session.getSharedDictionaryInfo(options)
  • session.clearSharedDictionaryCache()
  • session.clearSharedDictionaryCacheForIsolationKey(options)

Unresponsive Renderer JavaScript Call Stacks​

Electron's unresponsive event occurs whenever a renderer process hangs for an excessive period of time. The new WebFrameMain.collectJavaScriptCallStack() API added by @samuelmaddock in #44204 allows you to collect the JavaScript call stack from the associated WebFrameMain object (webContnets.mainFrame).

This API can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript events causing the process to hang. For more information, see the proposed web standard Crash Reporting API.

Main Process
const { app } = require('electron');

app.commandLine.appendSwitch(
'enable-features',
'DocumentPolicyIncludeJSCallStacksInCrashReports',
);

app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack();
console.log('Renderer unresponsive\n', callStack);
});
});
警告

This API requires the 'Document-Policy': 'include-js-call-stacks-in-crash-reports' header to be enabled. 详见: #45356

Electron 33.0.0

· 阅读时间:约 5 分钟

Electron 33.0.0 已发布!它包括对 Chromium 130.0.6723.44、V8 13.0 和 Node 20.18.0 的升级。


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

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

重要变化​

  • 添加了一个处理程序 app.setClientCertRequestPasswordHandler(handler),以帮助在需要 PIN 时解锁加密设备。 #41205
  • 扩展 navigationHistory API,增加两个新功能以改善 history 管理。 #42014
  • 改善了原生主题透明度检查。 #42862

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 或者从我们的发布网站下载它。继续阅读此版本的详细信息。

如果您有任何反馈,请在 Twitter 或 Mastodon 上与我们分享,或加入我们的 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

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 或者从我们的发布网站下载它。继续阅读此版本的详细信息。

如果您有任何反馈,请在 Twitter 或 Mastodon 上与我们分享,或加入我们的 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

Electron 30.0.0

· 阅读时间:约 5 分钟

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 或者从我们的发布网站下载它。继续阅读此版本的详细信息。

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

重要变化​

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

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 或者从我们的发布网站下载它。继续阅读此版本的详细信息。

如果您有任何反馈,请在 Twitter 或 Mastodon 上与我们分享,或加入我们的 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 Fuse, grantFileProtocolExtravileges 让 file:// 协议使其具有更安全和更严格的行为,与 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

· 阅读时间:约 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 或者从我们的发布网站下载它。继续阅读此版本的详细信息。

如果您有任何反馈,请在 Twitter 或 Mastodon 上与我们分享,或加入我们的 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 对象中,包括 detected,maximumCursorSize 和 nativeOrigin。 #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 来替代它

IpcRendererEvent 的 senderId 和 senderIsMainFrame 属性也已经被移除。

移除: 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

· 阅读时间:约 4 分钟

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


Electron 团队很高兴发布了 Electron 27.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. 继续阅读此版本的详细信息。

如果您有任何反馈,请在 Twitter 或 Mastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 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 ! You can install it with npm via npm install electron@latest or download it from our releases website. 继续阅读此版本的详细信息。

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