跳转到主内容

· 阅读时间:约 2 分钟

2021年12月Electron项目将进入暂停状态,然后在2022年1月全速恢复。

通过 GIPHY


12月保持不变的内容

  1. 必要时将发布零日和其他与安全相关的主版本。 安全事件应该通过 SECURITY.md 报告。
  2. 行为准则报告和审核将继续。

12月变动的内容

  1. 12 月没有新的 Beta 版或稳定版。 12 月的最后两周没有Nightly版本。
  2. 除了少数例外,不会合并请求的审核或合并。
  3. 任何仓库上都不会有问题跟进更新。
  4. 维护人员不会提供 Discord 调试帮助。
  5. 社交媒体暂停更新内容。

为什么会发生这种情况?

简而言之,虽然维护者对项目感到满意并参与其中,但世界很累。 对于大多数公司来说,12 月是一个安静的月份,所以我们希望给我们的维护者一个充电的机会。 我们鼓励其他项目考虑采取类似措施。

我是否应该担心Electron的未来?

否。 我们之所以能够迈出这一步,是因为项目进展顺利。 每个人都期待着2022年的到来,我们期待着会有好事!

· 阅读时间:约 6 分钟

Electron 15.0.0 已发布! 它包括升级到 Chromium 94, V8 9.4, 和 Node.js 16.5.0。 我们已经添加了多个针对 window.open 的 API 更新、bug 修复和常规改进。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 15.0.0.0! 您可以通过 npm install electron@later 进行安装,或者从我们的 发布网站 下载它。 继续阅读有关此版本的详细信息,并请分享您的任何反馈!

重要变化

Electron 发布时间变更

从 Electron 15 开始,Electron 将每隔8周发布一个新的主要稳定版本。 您可以在此处阅读 完整详细信息

此外,Electron 将在 2022 年 5 月之前,将支持的版本从最新的三个版本更改为最新的四个版本。 查看我们的版本文档以了解更多关于 Electron 版本的详细信息。

架构(Stack)更新

Highlight Features

  • nativeWindowOpen: true 不再是实验性的,现在是默认设置。
  • 新增了 safeStorage 字符串加密 API。 #30430
  • WebContents 新增 'frame-created' 事件,该事件在页面中创建帧时发出。 #30801
  • BrowserWindowwill-resize 事件添加了用以调整窗口大小的 edge 信息。 #29199

有关新功能和变更的完整列表,请参阅 15.0.0 发布通知

重大更改

以下是 Electron 15 中引入的突破性变化。 有关这些和未来变化的更多信息可在 计划的突破性变化 页面找到。

默认值更改:nativeWindowOpen 默认设为 true

在 Electron 15之前, window.open 默认使用 BrowserWindowProxy。 这意味着 window.open('about:blank') 无法打开可同步编写脚本的子窗口,以及有其他不兼容之处。 nativeWindowOpen: true 不再是实验性的,现在是默认设置。

有关更多详细信息,请参阅 Electron 中 window.open 的文档。

API 更改

  • WebContents 新增 'frame-created' 事件,该事件在页面中创建帧时发出。 #30801
  • 新增了 safeStorage 字符串加密 API。 #30430
  • dialog.showMessageBox 新增了 signal 选项。 #26102
  • 加入 Electron Fuse,用于在应用程序加载的 app.asar 文件上强制执行代码签名。 要求最新的 asar 模块(v3.1.0 或更高版本)。 #30900
  • 加入 fuses 以在打包好的应用里,禁用 NODE_OPTIONS--inspect 调试参数。 #30420
  • 新增 MenuItem.userAccelerator 属性以读取用户分配的 macOS 快捷键的覆盖。 #26682
  • 新增 app.runningUnderARM64Translation 属性以检测在 Rosetta 在 Apple Silicon 或 WOW 在 Windows 上运行 ARM 时的情况。 #29168
  • 添加新的 imageAnimationPolicy Web 首选项来控制图像的动画方式。 #29095
  • 增加支持通过 context bridge 发送 Blob。 #29247

Removed/Deprecated Changes

没有 API 被删除或废弃。

支持版

此外,Electron 将在 2022 年 5 月之前,将支持的版本从最新的三个版本更改为最新的四个版本。 在 Electron 19 之后,我们将回归到支持最新的三个版本。 此版本支持变化是我们新的节奏变化的一部分。 请参阅 我们的博客文章 ,了解的完整详细信息。

鼓励开发者和应用程序升级到 Electron 的较新版本。

E15 (2021年9月)E16 (2021年11月)E17 (2022年2月)E18 (2022年3月)E19 (2022年5月)
15.x.y16.x.y17.x.y18.x.y19.x.y
14.x.y15.x.y16.x.y17.x.y18.x.y
13.x.y14.x.y15.x.y16.x.y17.x.y
12.x.y13.x.y14.x.y15.x.y--

接下来

短期内, 您可以期待团队继续专注于跟上 Electron 主要组件的开发工作。 包括 Chromium, Node 和 V8。 尽管我们谨慎地避免对发布日期做出承诺,但我们的计划是大约每季度发布一次 Electron 的新主要版本以及这些组件的新版本。

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

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

· 阅读时间:约 7 分钟

Electron 14.0.0 已发布! 它包括了到 Chromium 93 和 V8 9.3 的更新。 我们添加了多个 API 更新、错误修复和一般改进。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 14.0.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release and please share any feedback you have!

重要变化

Electron 发布时间变更

Beginning in September 2021 with Electron 15, Electron will release a new major stable version every 8 weeks. 您可以在此处阅读 完整详细信息。 Electron 15 will begin beta on September 1, 2021 and stable release will be on September 21, 2021. 您可以在此处找到 Electron 的公开时间表。 Additionally, Electron will be changing supported versions from latest three versions to latest four versions until May 2022. See see our versioning document for more detailed information about versioning in Electron.

架构(Stack)更新

Highlight Features

  • Default Changed: nativeWindowOpen now defaults to true. (see docs)
  • Child windows no longer inherit BrowserWindow construction options from their parents. #28550
  • Added new session.storagePath API to get the path on disk for session-specific data. #28665
  • Added process.contextId used by @electron/remote. #28007
  • Added experimental cookie encryption support behind an Electron Fuse. #29492

有关新功能和变更的完整列表,请参阅 14.0.0 发布通知

重大更改

以下是 Electron 14 中引入的破坏性变更。 More information about these and future changes can be found on the Planned Breaking Changes page.

已移除: app.allowRendererProcessReuse

The app.allowRendererProcessReuse property has been removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.

更多信息见:#18397

移除: Browser Window Affinity

The affinity option when constructing a new BrowserWindow has been removed as part of our plan to more closely align with Chromium's process model for security, performance and maintainability.

更多信息见:#18397

API 更改: window.open()

The optional parameter frameName no longer sets the title of the window. This behavior now follows the specification described by the native documentation for the windowName parameter.

If you were using this parameter to set the title of a window, you can instead use the win.setTitle(title) method.

已移除: worldSafeExecuteJavaScript

worldSafeExecuteJavaScript has been removed with no alternative. Please ensure your code works with this property enabled. It has been enabled by default since Electron 12.

若您使用了 webFrame.executeJavaScriptwebFrame.executeJavaScriptInIsolatedWorld,这个改动会对您造成影响。 您将需要确保这些方法中任何一种返回的值都被 Context Bridge API 支持,因为这些方法使用相同的值传递语意。

默认更改: nativeWindowOpen 默认为 true

在 Electron 14之前, window.open 默认使用 BrowserWindowProxy。 这意味着 window.open('about:blank') 无法再来打开可同步脚本的子窗口,以及其他不兼容的情况。 nativeWindowOpen 不再是实验性的,现在是默认值

更多详细信息: window.open

移除: 从父窗口继承的 BrowserWindowConstructorOptions

在Electron 14之前,使用 window.open 打开的窗口将继承 BrowserWindow构造函数选项,例如 transparentresizable ,这些选项来自其父窗口 。 Beginning with Electron 14, this behavior has been removed and windows will not inherit any BrowserWindow constructor options from their parents.

相反,请使用 setWindowOpenHandler显式设置新窗口的选项:

webContents.setWindowOpenHandler((details) => {
return {
action: 'allow',
overrideBrowserWindowOptions: {
// ...
},
};
});

已移除: additionalFeatures

WebContents 的 new-windowdid-create-window 事件中已弃用的 additionalFeatures 属性已被删除。 由于 new-window 使用 positional 参数,因此该参数仍然存在,但始终 空数组 []。 (Note: the new-window event itself is already deprecated and has been replaced by setWindowOpenHandler.) 窗口功能中的 Bare keys 现在会显示为选项对象中值为 true 的 key。

// 在 Electron 14 移除
// Triggered by window.open('...', '', 'my-key')
webContents.on('did-create-window', (window, details) => {
if (details.additionalFeatures.includes('my-key')) {
// ...
}
});

// Replace with
webContents.on('did-create-window', (window, details) => {
if (details.options['my-key']) {
// ...
}
});

移除: remote 模块

Deprecated in Electron 12, the remote module has now been removed from Electron itself and extracted into a separate package, @electron/remote. The @electron/remote module bridges JavaScript objects from the main process to the renderer process. This lets you access main-process-only objects as if they were available in the renderer process. This is a direct replacement for the remote module. See the module's readme for migration instructions and reference.

API 更改

  • Added BrowserWindow.isFocusable() method to determine whether a window is focusable. #28642
  • Added WebFrameMain.visibilityState instance property. #28706
  • Added disposition, referrer and postBody to the details object passed to the window open handler registered with setWindowOpenHandler. #28518
  • Added process.contextId used by @electron/remote. #28007
  • Added experimental cookie encryption support behind an Electron Fuse. #29492
  • Added missing resourceType conversions for webRequest listener details: font, ping, cspReport, media, webSocket. #30050
  • Added new session.storagePath API to get the path on disk for session-specific data. #28665
  • Added support for Windows Control Overlay on macOS. #29986
  • Added support for directing Chromium logging to a file with --log-file=.../path/to/file.log. Also, it's now possible to enable logging from JavaScript by appending command-line switches during the first JS tick. #29963
  • Added support for the des-ede3 cipher in node crypto. #27897
  • Added a ContextBridgeMutability feature that allows context bridge objects to be mutated. #27348

Removed/Deprecated Changes

The following APIs have been removed or are now deprecated:

  • The remote module has been removed after being deprecated in Electron 12. #25734
  • Child windows no longer inherit BrowserWindow construction options from their parents. #28550
  • Removed deprecated additionalFeatures property from new-window and did-create-window WebContents events. #28548
  • Removed the deprecated app.allowRendererProcessReuse and BrowserWindow affinity options. #26874
  • The submitURL option for crashReporter.start is no longer a required argument when uploadToServer is false. #28105

终止对 11.x.y 的支持

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

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。 尽管我们谨慎地避免对发布日期做出承诺,但我们的计划是大约每季度发布一次 Electron 的新主要版本以及这些组件的新版本。

For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes.

· 阅读时间:约 8 分钟

在过去几周里,我们收到了关于新的 WebView2 和 Electron 之间差异的几个问题。

我们两个团队都致力于让 Web 技术在桌面上能发挥出最佳效用,同时互相讨论比较了二者之间的共性与不同之处。

Electron 和 WebView2 都处在一个快速不断发展的进程中。 我们将对 Electron 与 WebView2 之间现有的相似之处与不同的地方做简短的概述。


架构概述

Electron 和 WebView2 都是从 Chromium 源代码构建的,用于渲染网页内容。 严格地说,WebView2 是从 Edge 源构建的,Edge 构建于 Chromium 源的一个分支上。 Electron 不与 Chrome 共享任何 DLL。 WebView2 的二进制文件与 Edge 硬链接(Edge 90 的稳定版本),因此他们共享磁盘和一些工作集。 更多信息,请参阅 Evergreen distribution mode

Electron 应用程序总是以开发时确认的 Electron 版本,打包和发布。 WebView2 有两个分布选项。 你可以打包确切的 WebView2 库到你的应用程序,或你可以使用系统中已经存在的共享运行版本。 WebView2 为每种方法提供了工具,包括缺少共享运行时的引导安装程序。 WebView2 从 Windows 11 开始直接提供。

打包框架的应用程序负责更新框架,包括安全的次要版本。 对于使用共享 WebView2 运行时的应用,WebView2 具有自己的更新程序,类似于 Chrome 或 Edge,独立于您的应用程序。 要更新应用程序自己的代码或其它依赖仍然是开发人员自己负责,这与 Electron 一样。 无论是 Electron,还是 WebView2 都不受 Windows Update 管理。

Electron 和 WebView2 都继承了 Chromium 的多进程架构,即一个主进程与一个或多个渲染器进程相连。 这些进程与系统上运行的其他应用程序完全分离。 每个 Electron 应用程序都是一个单独的进程树,包含一个根浏览器进程、一些公共进程以及零个或多个渲染进程。 WebView2 应用间使用相同的 用户数据文件夹 (就像一套应用一样),共享非渲染进程。 WebView2 应用使用不同的 数据文件夹,不共享进程。

  • ElectronJS 进程模型:

    ElectronJS 进程模型图解

  • 基于 WebView2 的应用程序进程模型:

    WebView2 进程模型图解

了解关于 WebView2 进程模型 Electron 进程模型 的更多信息。

Electron 提供常见的桌面应用程序所需要的 API,如菜单、文件系统访问、通知等等。 WebView2 是一个组件,意味着需要被集成到应用程序框架中,如 WinForms、WPF、WinUI 或 Win32。 WebView2 不提供 Web 标准 JavaScript 之外的操作系统 API。

Node.js 被集成到 Electron 中。 Electron应用程序可以在渲染进程和主进程中使用,任何 Node.js API,模块,或 node 本地模块(node-native-addon)。 WebView2 不知道您的应用程序使用哪种语言或框架编写。 您的 JavaScript 代码必须通过应用程序主进程代理操作系统访问。

Electron 努力维持与 Web API 的兼容性,包括从 Fugu Project 被开发的 API。 我们有一个 Electron 的 Fugu API 兼容快照。 WebView2 维护着一个 与 Edge 差异 API (API differences from Edge) 相似的列表。

Electron 为 web 内容提供一个可配置的安全模型,从完全访问到完全沙箱。 WebView2 内容始终是沙盒。 Electron 为您选择安全模型提供 全面的安全文档 。 WebView2 也有提供 安全最佳实践

Electron 源码在 GitHub 上维护与获取。 应用程序可以自己修改,构建属于自己的 独特 Electron. WebView2 源码不能在 Github 上获取。

摘要:

ElectronWebView2
构建依赖ChromiumEdge
源码在 Github
共享 Edge/Chrome 动态库是 (从 Edge 90 版本)
应用程序之间的共享运行时可选
应用程序 API
Node.js
Sandbox可选始终
需要应用程序框架
支持平台Mac, Win, LinuxWin (Mac/Linux 计划中)
应用之间的进程共享从不可选
框架更新管理通过应用程序WebView2

性能讨论

在渲染 Web 内容时,我们认为 Electron,WebView2 和其他基于 Chromium 的渲染之间的性能差异很小。 我们为感兴趣研究性能间差异的人员,以 Electron、C++ + WebView2 和 C# + WebView2 创建了 脚手架

在渲染 Web 内容 之外 有一些差异,来自 Electron,WebView2,Edge,PWA,和 其它表示感兴趣工作的详细比较。

进程间通信 (IPC)

我们明确强调一个差异,因为我们认为这通常是 Electron 应用程序中的性能考虑因素。

在 Chromium 中,浏览器进程(browser process)作为渲染进程沙盒与系统其部分间的 IPC 中间人。 虽然 Electron 允许未沙盒化的渲染进程,但很多应用程序仍选择启用沙盒以增加安全性。 WebView2 始终启用沙盒,所以对于大多数 Electron 和 WebView2 应用程序,IPC 可能会影响整体性能。

尽管 Electron 和 WebView2 具有相似的进程模型,但底层 IPC 不同。 在 JavaScript 和 C++ 或 C# 之间进行通信需要 转换(marshalling),常见的是 JSON 字符串。 JSON 序列化/解析是一项代价高昂的操作,IPC 瓶颈可能会对性能产生负面影响。 从 Edge 93 开始,Webview2 将针对网络事件使用 CBOR(简洁的二进程序列化)

Electron 通过 MessagePorts API 支持任何两个进程之间的直接 IPC,利用 结构化克隆算法。 利用此手段的应用程序可以避免在进程之间发送对象时支付 JSON 序列化税。

摘要

Electron 和 WebView2 有一些差异,但在他们如何执行 Web 内容方面不会有太大差异。 最后,应用程序架构和 JavaScript 库/框架对内存和性能的影响比其他任何内容都要大,因为无论 Chromium 运行在何处, Chromium 都是 Chromium

特别感谢 WebView2 团队审阅了这篇文章,并确保我们拥有 WebView2 架构的最新视图。 他们欢迎对项目的任何反馈意见

· 阅读时间:约 9 分钟

从2021年9月开始,Electron将每8周发布一个新的主要稳定版本。


2019年,Electron 改为12周的发布周期,以匹配 Chromium 的6周发布周期。 最近,Chrome 和 Microsoft 都发生了一些变化,使得我们重新考虑更改 Electron 目前的发布频率:

  1. Chromium 计划从2021年9月21日的 Chrome 94 开始每4周发布一个新的里程碑。此版本节奏还每8周添加新的"扩展稳定"选项,其中包含所有更新的安全修补程序。

  2. 微软应用商店要求 基于Chromium应用的版本号不得低于最新发行版本2个版本号。 例如,如果最新发布的Chromium主版本号为85,任何基于Chromium的应用其所用版本必须为83或更高。 以上规则包含Electron应用。

从2021年9月开始,Electron将每8周发布一个新的主要稳定版本,以匹配Chromium的8周扩展稳定版本。

我们的第一个发行版Electron 15将会随Chromium扩展稳定版在2021年9月21日释出。

需要注意的是,版本发行频率的改变会影响下游应用程序的开发,我们想让我们的开发者社区尽快知晓此次改变。 请阅读我们的2021开发计划以获取更多详情。

Electron 15:临时 Alpha 内测版本

基于我们的Electron15初始版本针对的是Chromium的非扩展稳定版(其扩展稳定版基于偶数版本号),我们需要改变我们的初始目标发行日期。 然而,一款Electron的app必须使用最近两个版本以内的Chromium以便能被微软商店收录,这项新规定会使得等待两个新版本变得不可持续。

伴随着这两项要求,我们的团队也面临着时间规划上的挑战。 推进Electron 15以包括Chromium的M94版本会使得应用开发者们能快速获取最新的Chromium扩展稳定版;然而这也会使得公测版到稳定版的开发周期缩短到只有3周。

为了有利于此次变动,Electron将会提供一个临时的内测版本,并仅限于Electron 15系列的发行版。 本内测版将给与开发者们更多时间,用这款比每日版更稳定的版本去测试和规划他们的Eletron15。

Electron 15系列内测版本频道将会于2021年7月21日开通。 It will transition to a beta release on September 1st, 2021 with a stable release target of September 21st, 2021. 在那之后的Electron发行版将不再包含内测系列。

2021 发行计划

以下是我们当前的2021发行计划:

ElectronChromeAlpha 版本Beta 版本Stable 版Stable 发布周期(周数)
E13M91-2021年3月5日2021年5月25日12
E14M93-2021年5月26日2021年8月31日14
E15M942021年7月20日2021年9月01日2021年9月21日9周(包含 alpha 版本)
E16M96-2021年9月22日2021年11月16日8
E17M98-2021年11月17日2022年2月1日11

添加 alpha 通道将 Electron 15 发布前的开发时间从 3 周延长到 9 周 - 更接近我们新的 8 周周期,同时仍满足 Windows 应用商店提交的要求。

为了进一步帮助应用程序开发人员, 从2021年的剩余时间到2022年5月,我们还将把我们支持的版本政策从最新的3个版本扩展到最新的4个版本的Electron。 这意味着即使您无法立即更改升级计划,旧版本的Electron仍将收到安全更新和修复程序。

解决疑虑

在安排此发布周期更改之前,我们发布这篇文章是有原因的。 我们知道,更快的发布周期将对Electron应用程序产生真正的影响 - 其中一些应用程序可能已经认为我们的主要发布节奏过于频繁。

我们试图解决以下常见问题:

❓ 为什么要做这样的改变? 为什么不保持12周的发布节奏呢?

为了在Electron中提供最新版本的Chromium,我们的发布计划需要跟踪他们的版本。 有关Chromium发布周期的更多信息可以在这里找到

此外,目前12周的发布节奏将无法满足Microsoft应用商店的新提交要求。 即使是最新稳定版本的Electron上的应用程序也会经历大约两周的时间,他们的应用程序根据新的安全要求可能会被拒绝。

每个新的 Chromium 版本都包含新的功能,错误修复/安全修复和V8 改进。 作为应用程序开发人员,我们希望你们及时做出这些更改,所以我们的稳定版本日期将继续与其他Chromium稳定版本保持一致。 作为应用程序开发人员,您将比以前更快地获得Chromium和V8的新功能和修复程序。

❓ 现有的12周发布计划已经进展很快。 团队正在采取哪些步骤来简化升级?

更频繁发版的一个好处是发版内容更少 。 我们知道升级Electron的主版本可能是困难的。 我们希望较小的版本将减少每个版本中 Chromium和Node 重大更改,以及更少的破坏性改动。

❓ 未来的 Electron 版本会提供 alpha 版本吗?

目前没有支持永久性的 Alpha 版本的计划。 此 Alpha 仅适用于 Electron 15,作为帮助开发人员在较短的发布周期内更轻松升级的一种方式。

❓ Electron 会扩展支持的版本数量吗?

随着 Electron 19 的发布,我们将支持的版本政策从 Electron 的最新三个版本扩展到最新的四个版本直到 2022 年 5 月。 在 Electron 19 发布后,我们将返回 支持最新的三个主版本,以及 beta 和 nightly 版本。

E13 (2021年5月)E14 (2021年8月)E15 (2021年9月)E16 (2021年11月)E17 (2022年2月)E18 (2022年3月)E19 (2022年5月)
13.x.y14.x.y15.x.y16.x.y17.x.y18.x.y19.x.y
12.x.y13.x.y14.x.y15.x.y16.x.y17.x.y18.x.y
11.x.y12.x.y13.x.y14.x.y15.x.y16.x.y17.x.y
----12.x.y13.x.y14.x.y15.x.y--

问题?

📨 您有任何问题或疑虑,请发送邮件至 info@electronjs.org加入我们的Discord。 我们知道这是一个将影响许多应用程序和开发者的变化,您的反馈对我们非常重要。 我们希望收到您的来信!

· 阅读时间:约 4 分钟

Electron 13.0.0 已发布! 它包括了到 Chromium 91 和 V8 9.1 的更新。 我们添加了多个 API 更新、错误修复和一般改进。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 13.0.0.0! 您可以通过 npm 安装electron@later 或者从我们的 发布网站 下载它。 Continue reading for details about this release, and please share any feedback you have!

重要变化

架构(Stack)更新

Highlight Features

  • Added process.contextIsolated property that indicates whether the current renderer context has contextIsolation enabled. #28252
  • Added new session.storagePath API to get the path on disk for session-specific data. #28866
  • Deprecated the new-window event of WebContents. 它被替换为 webContents.setWindowOpenHandler()
  • Added process.contextId used by @electron/remote. #28251

有关新功能和变更的完整列表,请参阅 13.0.0 发布通知

重大更改

  • window.open() parameter frameName is no longer set as window title. #27481
  • Changed session.setPermissionCheckHandler(handler) to allow for handler's first parameter, webContents to be null. #19903

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

API 更改

  • Added roundedCorners option for BrowserWindow. #27572
  • Added new session.storagePath API to get the path on disk for session-specific data.28866
  • Added support for passing DOM elements over the context bridge. #26776
  • Added process.uptime() to sandboxed renderers. #26684
  • Added missing fields to the parameters emitted as part of the context-menu event.#26788
  • Added support for registering Manifest V3 extension service workers.
  • Added ‘registration-completed’ event to ServiceWorkers. #27562

Removed/Deprecated Changes

The following APIs have been removed or are now deprecated:

  • Deprecated the new-window event of WebContents. 它被替换为 webContents.setWindowOpenHandler()

  • Removed deprecated shell.moveItemToTrash(). #26723

  • Removed the following deprecated BrowserWindow extension APIs:

    • BrowserWindow.addExtension(path)
    • BrowserWindow.addDevToolsExtension(path)
    • BrowserWindow.removeExtension(name)
    • BrowserWindow.removeDevToolsExtension(name)
    • BrowserWindow.getExtensions()
    • BrowserWindow.getDevToolsExtensions()

    Use the session APIs instead:

    • ses.loadExtension(path)
    • ses.removeExtension(extension_id)
    • ses.getAllExtensions()
  • systemPreferences 方法已经被废弃:

    • systemPreferences.isDarkMode()
    • systemPreferences.isInvertedColorScheme()
    • systemPreferences.isHighContrastColorScheme()

    使用 nativeTheme 属性作为替代:

    • nativeTheme.shouldUseDarkColors
    • nativeTheme.shouldUseInvertedColorScheme
    • nativeTheme.shouldUseHighContrastColors

终止对 10.x.y 的支持

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

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。 尽管我们谨慎地避免对发布日期做出承诺,但我们的计划是大约每季度发布一次 Electron 的新主要版本以及这些组件的新版本。 暂定 14.0.0 时间表 展示了 Electron 14.0 开发生命周期中的关键日期。 Also, see our versioning document for more detailed information about versioning in Electron.

For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.

· 阅读时间:约 6 分钟

Electron 12.0.0 已发布! It includes upgrades to Chromium 89, V8 8.9 and Node.js 14.16. We've added changes to the remote module, new defaults for contextIsolation, a new webFrameMain API, and general improvements. 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 12.0.0.0! 您可以通过 npm 安装electron@later 或者从我们的 发布网站 下载它。 Continue reading for details about this release, and please share any feedback you have!

重要变化

架构(Stack)更新

Highlight Features

  • The ContextBridge exposeInMainWorld method can now expose non-object APIs. #26834
  • Upgraded from Node 12 to Node 14. #23249
  • Added a new webFrameMain API for accessing sub-frames of a WebContents instance from the main process. #25464
  • The default values of contextIsolation and worldSafeExecuteJavaScript are now true. #27949 #27502

有关新功能和变更的完整列表,请参阅 12.0.0 发布通知

重大更改

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

API 更改

  • Added webFrameMain API: The webFrameMain module can be used to look up frames across existing WebContents instances. This is the main process equivalent of the existing webFrame API. More information about this new API can be found here, and in our documentation.
  • app API changes:
    • Added non-localized serviceName to 'child-process-gone' / app.getAppMetrics(). #25975
    • Added new app.runningUnderRosettaTranslation property to detect when running under rosetta on Apple silicon. #26444
    • Added exitCode to render-process-gone details (app & webContents). #27677
  • BrowserWindow API changes:
    • Added BrowserWindow.isTabletMode() API. #25209
    • Added resized (Windows/macOS) and moved (Windows) events to BrowserWindow. #26216
    • Added new system-context-menu event to allow preventing and overriding the system context menu. #25795
    • Added win.setTopBrowserView() so that BrowserViews can be raised. #27713
    • Added webPreferences.preferredSizeMode to allow sizing views according to their document's minimum size. #25874
  • contextBridge API changes:
    • Allowed ContextBridge exposeInMainWorld method to expose non-object APIs. #26834
  • display API changes:
    • Added displayFrequency property to the Display object to allow getting information about the refresh rate on Windows. #26472
  • extensions API changes:
    • Added support for some chrome.management APIs. #25098
  • MenuItem API changes:
    • Added support for showing macOS share menu. #25629
  • net API changes:
    • Added a new credentials option for net.request(). #25284
    • Added net.online for detecting whether there is currently internet connection. #21004
  • powerMonitor API changes:
    • 已添加 powerMonitor.onBatteryPower#26494
    • Added fast user switching event to powerMonitor on macOS. #25321
  • session API changes:
    • Added allowFileAccess option to ses.loadExtension() API. #27702
    • Added display-capture API for session.setPermissionRequestHandler. #27696
    • Added a disabledCipherSuites option to session.setSSLConfig. #25818
    • Added extension-loaded, extension-unloaded, and extension-ready events to session. #25385
    • Added session.setSSLConfig() to allow configuring SSL. #25461
    • Added support for explicitly specifying direct, auto_detect or system modes in session.setProxy(). #24937
    • Added Serial API support. #25237
    • Added APIs to enable/disable spell checker. #26276
  • shell API changes:
    • Added a new asynchronous shell.trashItem() API, replacing the synchronous shell.moveItemToTrash(). #25114
  • webContents API changes:
    • Added a small console hint to console to help debug renderer crashes. #25317
    • Added frame and webContents properties to the details object in webRequest handlers. #27334
    • Added webContents.forcefullyCrashRenderer() to forcefully terminate a renderer process to assist with recovering a hung renderer. #25580
    • Added setWindowOpenHandler API for renderer-created child windows, and deprecate new-window event. #24517
  • webFrame API changes:
    • Added spellcheck API to renderer. #25060

Removed/Deprecated Changes

The following APIs have been removed or are now deprecated:

  • Deprecated the remote module. It is replaced by @electron/remote. #25293
  • Removed deprecated crashReporter APIs. #26709
  • Removed links to the Electron website from the default 'Help' menu in packaged apps. #25831

终止对 9.x.y 的支持

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

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。 尽管我们谨慎地避免对发布日期做出承诺,但我们的计划是大约每季度发布一次 Electron 的新主要版本以及这些组件的新版本。 暂定 13.0.0 时间表 展示了 Electron 13.0 开发生命周期中的关键日期。 Also, see our versioning document for more detailed information about versioning in Electron.

For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.

· 阅读时间:约 4 分钟

Electron 11.0.0 已发布! 它包括升级到 Chromium 87, V8 8.7, 和 Node.js 12.18.3。 我们已经添加了对Apple silicon和一般改进的支持。 请阅读下文了解更多详情!


Electron 团队很高兴发布了 Electron 11.0.0.0! 您可以通过 npm 安装electron@later 或者从我们的 发布网站 下载它。 新版本包括内容更新及问题修复,提供对Apple M1的硬件支持。

We can't wait to see what you build with them! Continue reading for details about this release, and please share any feedback you have!

重要变化

架构(Stack)更新

Highlight Features

有关新功能和变更的完整列表,请参阅 11.0.0 发布通知

重大更改

  • 移除实验性API: BrowserView.{fromId, fromWebContents, getAllViews}BrowserViewid属性. #23578

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

API 更改

  • Added app.getApplicationInfoForProtocol() API that returns detailed information about the app that handles a certain protocol. #24112
  • Added app.createThumbnailFromPath() API that returns a preview image of a file given its file path and a maximum thumbnail size. #24802
  • Added webContents.forcefullyCrashRenderer() to forcefully terminate a renderer process to assist with recovering a hung renderer. #25756

终止对 8.x.y 的支持

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

接下来

在短期内,您可以期待团队继续专注于跟上构成 Electron 的主要组件的开发,包括 Chromium、Node 和 V8。 Although we are careful not to make promises about release dates, our plan is to release new major versions of Electron with new versions of those components approximately quarterly. 暂定 12.0.0 时间表 展示了 Electron 12.0 开发生命周期中的关键日期。 Also, see our versioning document for more detailed information about versioning in Electron.

For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.

未来将弃用 remote 模块

我们已经着手移除Electron 9中的 remote 模块, 计划在Electron 14中完成。

要想知道有关移除计划的全部细节,请阅读并关注 这里

Final Step for Requiring Native Node Modules to be Context Aware or N-API (in Electron 12)

From Electron 6 onwards, we've been laying the groundwork to require native Node modules loaded in the renderer process to be either N-API or Context Aware. Enforcing this change allows for stronger security, faster performance, and reduced maintenance workload. The final step of this plan is to remove the ability to disable render process reuse in Electron 12.

要想知道其他细节或时间相关的问题,请阅读并关注 这里

· 阅读时间:约 5 分钟

随着苹果芯片将于今年晚些时候发布,您如何让Electron应用程序在新硬件上运行?


随着Electron 11.0.0-beta.1的发布,Electron团队现在正在编写在苹果计划于今年晚些时候发货的新苹果芯片上运行的Electron版本。 你可以通过npm install electron@beta或从官网来下载最新的Beta版本。

它是如何工作的?

从Electron 11开始,我们将为Intel Mac和Apple Silicon Mac发布不同的Electron版本。 在这个变化之前,我们已经发布了两个版本, darwin-x64mas-x64,后者是用于Mac App Store 兼容性的使用。 我们现在已发布另外两个版本 darwin-arm64mas-arm64,为上述版本的 Apple Silicon 版本。

我需要做什么?

您将需要发布两个版本的应用:一个版本用于 x64(Intel Mac),另一个版本用于arm64(Apple Silicon)。 好消息是 electron-packager, electron-rebuildelectron-forge 已经为 arm64 架构做好了支持。 只要您正在运行这些软件包的最新版本,您的应用就应该在将目标架构更新到 arm64 后正常工作。

将来, 我们将发布一个软件包,允许您将您的 arm64x64 应用“合并”到一个单一的通用二进制软件包, 但值得注意的是,这个二进制文件可能会 非常巨大 并且可能不适合给用户发布。

更新:此软件包现在可在 @electron/universal 上使用。 您可以使用它将两个以打包的 x64 和 arm64 应用程序合并为一个二进制程序。

潜在问题

原生模块

当您正在针对一个新的架构时,您需要更新几个依赖关系,这可能会导致构建问题。 下面包含某些依赖关系的最低版本以供您参考。

依赖项版本要求
Xcode>=12.2
node-gyp>=7.1
electron-rebuild>=1.12
electron-packager>=15.1

由于这些依赖版本要求,您可能不得不修复/更新某些原生模块。 值得注意的是,Xcode 升级将引入新版本的 macOS SDK。 这可能会导致您的原生模块构建失败。

如何测试它

目前,Apple Silicon 应用程序只在 Apple Silicon 硬件上运行,在撰写这篇博文时暂没有商业用途。 如果您有一个开发者过渡套件,您可以在那里测试您的应用程序。 否则,您将不得不等待Apple Silicon硬件的生产发布,以测试您的应用是否正常。

Rosetta 2怎么样?

Rosetta 2 是苹果最近一次对他们的 Rosetta 技术的迭代。 允许您在新的 arm64 Apple Silicon 硬件上运行 x64 Intel 应用。 虽然我们相信x64 Electron应用程序将在Rosetta 2下运行,但有一些重要的事情需要注意(以及您应该发布原生arm64二进制文件的原因)。

  • 您的应用的性能将明显下降。 Electron / V8 为 JavaScript 使用 JIT 编译,因为 Rosetta 工作的原理。 您实际上将运行两次JIT (一次在 V8 中,一次在 Rosetta)。
  • 您失去了如内存页面大小的增加这样的 Apple Silicon 新技术的好处。
  • 我们是否提到性能将显著 降级?

· 阅读时间:约 3 分钟

Join us for community bonding and a month-long celebration of open-source.


Hacktoberfest and Discord banner

Electron Community Discord Launch

Electron’s Outreach Working Group is excited to announce the launch of our official community Discord server!

Why a new Discord server?

In its early days as the backbone of the Atom text editor, community discussion on the Electron framework occurred in a single channel in Atom’s Slack workspace. As time passed and the two projects were increasingly decoupled, the relevance of the Atom workspace to the Electron project decreased, and maintainer participation in the Slack channel declined in the same manner.

Up until now, we had still been redirecting our broader community to the Atom Slack workspace, even though we’ve had many reports from folks who have had trouble receiving invitations, and few of our core maintainers were frequenting the channel.

We’re setting up this shiny new server to be a central discussion hub for the community where you can get the latest news on all things Electron.

Get in here!

So far, the server’s membership consists of a few maintainers who have been working together to set it up, but we’re so excited to chat with you all! Come ask for help, keep up to date with Electron releases, or just hang out with other developers. We’ve got a handy invite for you that’ll give you access to the server!

Hacktoberfest 2020

作为一个大型和长期运行的开源项目,Electron如果没有其社区的所有 贡献就不会像现在这样成功。 从提交代码到错误报告到文档更改,还有更多。 That’s why we believe in the importance of participating in Hacktoberfest to usher in a wider community of developers of all skill levels into the project.

Odds and ends

This year, we don’t have a wider project to give you all to work on, but we’d like to focus on opportunities to contribute across the Electron JavaScript ecosystem.

Look out for issues tagged hacktoberfest across our various repositories, including the main electron/electron repository, the electron/electronjs.org website, electron/fiddle, and electron-userland/electron-forge!

P.S. If you're feeling particularly adventurous, we also have a backlog of issues marked with help wanted tags if you're looking for more of a challenge.

Stuck? Come chat with us!

Moreover, it’s also no coincidence that the grand opening of our Discord server coincides with the largest celebration of open-source software of the year. Check out the #hacktoberfest channel to ask for help on your Hacktoberfest PR. In case you missed it, here's the invite link again!