Electron 5.0.0
Electron 团队非常高兴地宣布 Electron 5.0.0 正式发布!你可以通过 npm install electron@latest
使用 npm 安装它,也可以从 我们的发布页面 下载 tarball。此版本包含升级、修复和新功能。我们迫不及待地想看看你使用它们构建的内容!继续阅读以了解有关此版本的详细信息,并请分享你的任何反馈!
¥The Electron team is excited to announce the release of Electron 5.0.0! You can install it with npm via npm install electron@latest
or download the tarballs from our releases page. The release is packed with upgrades, fixes, and new features. 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!
有什么新功能?
¥What's New?
Electron 的大部分功能由 Chromium、Node.js 和 V8 的核心组件提供。Electron 会持续关注这些项目,为我们的用户提供新的 JavaScript 功能、性能改进和安全修复。以下每个软件包在 Electron 5 中都有一个主要版本升级:
¥Much of Electron's functionality is provided by the core components of Chromium, Node.js, and V8. Electron keeps up-to-date with these projects to provide our users with new JavaScript features, performance improvements, and security fixes. Each of these packages has a major version bump in Electron 5:
-
Chromium
73.0.3683.119
-
Node.js
12.0.0
-
V8
7.3.492.27
.
Electron 5 还包含对 Electron 特定 API 的改进。主要变更摘要如下:查看完整的变更列表,请查看 Electron v5.0.0 版本说明。
¥Electron 5 also includes improvements to Electron-specific APIs. A summary of the major changes is below; for the full list of changes, check out the Electron v5.0.0 release notes.
Promisification
Electron 5 延续了 Promisification 倡议 的计划,将 Electron 基于回调的 API 转换为使用 Promises。以下 API 已针对 Electron 5 进行转换:
¥Electron 5 continues Promisification initiative initiative to convert Electron's callback-based API to use Promises. These APIs were converted for Electron 5:
-
app.getFileIcon
-
contentTracing.getCategories
-
contentTracing.startRecording
-
contentTracing.stopRecording
-
debugger.sendCommand
-
Cookies API
-
shell.openExternal
-
webContents.loadFile
-
webContents.loadURL
-
webContents.zoomLevel
-
webContents.zoomFactor
-
win.capturePage
macOS 的系统颜色访问
¥System colors access for macOS
这些函数已更改或添加到 systemPreferences
,以访问 macOS 系统的颜色:
¥These functions were changed or added to systemPreferences
to access macOS systems' colors:
-
systemPreferences.getAccentColor
-
systemPreferences.getColor
-
systemPreferences.getSystemColor
进程内存信息
¥Process memory information
已添加函数 process.getProcessMemoryInfo
以获取有关当前进程的内存使用情况统计信息。
¥The function process.getProcessMemoryInfo
has been added to get memory usage statistics about the current process.
远程 API 的额外筛选功能
¥Additional filtering for remote APIs
为了提高 remote
API 的安全性,添加了新的远程事件,以便 remote.getBuiltin
、remote.getCurrentWindow
、remote.getCurrentWebContents
和 <webview>.getWebContents
可以作为 filtered 使用。
¥To improve security in the remote
API, new remote events have been added so that remote.getBuiltin
, remote.getCurrentWindow
, remote.getCurrentWebContents
and <webview>.getWebContents
can be filtered.
浏览器窗口上的多个浏览器视图
¥Multiple BrowserViews on BrowserWindow
BrowserWindow 现在支持在同一个 BrowserWindow 中管理多个 BrowserView。
¥BrowserWindow now supports managing multiple BrowserViews within the same BrowserWindow.
重大变化
¥Breaking Changes
打包应用的默认值
¥Defaults for packaged apps
打包应用现在的行为与默认应用相同:除非应用本身有默认菜单,否则将创建默认应用菜单;除非应用处理该事件,否则将自动处理 window-all-closed
事件。
¥Packaged apps will now behave the same as the default app: a default application menu will be created unless the app has one and the window-all-closed
event will be automatically handled unless the app handles the event.
混合沙盒
¥Mixed sandbox
混合沙盒模式现已默认启用。使用 sandbox: true
启动的渲染器现在将真正处于沙盒状态,而以前只有在启用混合沙盒模式时才会处于沙盒状态。
¥Mixed sandbox mode is now enabled by default. Renderers launched with sandbox: true
will now be actually sandboxed, where previously they would only be sandboxed if mixed-sandbox mode was also enabled.
安全性改进
¥Security improvements
为了提高安全性,nodeIntegration
和 webviewTag
的默认值现已改为 false
。
¥The default values of nodeIntegration
and webviewTag
are now false
to improve security.
拼写检查器现在异步
¥Spellchecker now asynchronous
SpellCheck API 已更改为提供 异步结果。
¥The SpellCheck API has been changed to provide asynchronous results.
弃用
¥Deprecations
以下 API 在 Electron 5.0.0 中被弃用,并计划在 6.0.0 中删除:
¥The following APIs are newly deprecated in Electron 5.0.0 and planned for removal in 6.0.0:
适用于 arm 和 arm64 的 Mksnapshot 二进制文件
¥Mksnapshot binaries for arm and arm64
mksnapshot 的 arm 和 arm64 原生二进制文件已弃用,并将在 6.0.0 版本中移除。可以使用 x64 二进制文件为 arm 和 arm64 创建快照。
¥Native binaries of mksnapshot for arm and arm64 are deprecated and will be removed in 6.0.0. Snapshots can be created for arm and arm64 using the x64 binaries.
WebContents 上的 ServiceWorker API
¥ServiceWorker APIs on WebContents
已弃用 WebContents 上的 ServiceWorker API,准备将其移除。
¥Deprecated ServiceWorker APIs on WebContents in preparation for their removal.
-
webContents.hasServiceWorker
-
webContents.unregisterServiceWorker
带有沙盒 webContents 的自动模块
¥Automatic modules with sandboxed webContents
为了提高安全性,以下模块已弃用,无法通过 require
直接使用,而是需要通过 remote.require
将其包含在沙盒化的 Web 内容中:
¥In order to improve security, the following modules are being deprecated for use directly via require
and will instead need to be included via remote.require
in a sandboxed webcontents:
-
electron.screen
-
child_process
-
fs
-
os
-
path
webFrame 隔离世界 API
¥webFrame Isolated World APIs
webFrame.setIsolatedWorldContentSecurityPolicy
、webFrame.setIsolatedWorldHumanReadableName
、webFrame.setIsolatedWorldSecurityOrigin
已被弃用,取而代之的是 webFrame.setIsolatedWorldInfo
。
¥webFrame.setIsolatedWorldContentSecurityPolicy
,webFrame.setIsolatedWorldHumanReadableName
, webFrame.setIsolatedWorldSecurityOrigin
have been deprecated in favor of webFrame.setIsolatedWorldInfo
.
混合沙盒
¥Mixed sandbox
enableMixedSandbox
和 --enable-mixed-sandbox
命令行开关仍然存在,以实现兼容性,但已被弃用且无效。
¥enableMixedSandbox
and the --enable-mixed-sandbox
command-line switch still exist for compatibility, but are deprecated and have no effect.
2.0.x 停止支持
¥End of support for 2.0.x
根据我们的 支持的版本政策,2.0.x 版本已达到生命周期终点。
¥Per our supported versions policy, 2.0.x has reached end of life.
应用反馈计划
¥App Feedback Program
我们继续使用我们的 应用反馈计划 进行测试。参与此计划的项目在其应用上测试 Electron 测试版;作为回报,他们发现的新 bug 将优先发布到稳定版本。如果你想参与或了解更多信息,请联系 查看我们关于该程序的博客文章。
¥We continue to use our App Feedback Program for testing. Projects who participate in this program test Electron betas on their apps; and in return, the new bugs they find are prioritized for the stable release. If you'd like to participate or learn more, check out our blog post about the program.
下一步计划
¥What's Next
短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。虽然我们谨慎地不对发布日期做出承诺,但我们计划大约每季度发布一次 Electron 的新主要版本及其组件的新版本。暂定 6.0.0 计划 模块列出了 Electron 6 开发生命周期中的关键日期。此外,查看我们的版本控制文档 提供了有关 Electron 版本控制的更多详细信息。
¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8. Although we are careful not to make promises about release dates, our plan is release new major versions of Electron with new versions of those components approximately quarterly. The tentative 6.0.0 schedule maps out key dates in the Electron 6 development life cycle. Also, see our versioning document for more detailed information about versioning in Electron.
有关即将推出的 Electron 版本 查看我们的“计划重大变更”文档 中计划的重大变更的信息。
¥For information on planned breaking changes in upcoming versions of Electron, see our Planned Breaking Changes doc.