Electron 6.0.0
Electron 团队非常高兴地宣布 Electron 6.0.0 正式发布!你可以通过 npm install electron@latest
使用 npm 安装它,也可以从我们的 发布网站。此版本包含升级、修复和新功能。我们迫不及待地想看看你使用它们构建的内容!继续阅读以了解有关此版本的详细信息,并请分享你的任何反馈!
¥The Electron team is excited to announce the release of Electron 6.0.0! You can install it with npm via npm install electron@latest
or download it from our releases website. 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 项目的首次亮相:这是我们首次在 Chrome 稳定版本 发布的同一天发布稳定的 Electron 版本!🎉
¥Today marks a first for the Electron project: this is the first time we've made a stable Electron release on the same day as the corresponding Chrome stable release! 🎉
Electron 的大部分功能由 Chromium、Node.js 和 V8 的核心组件提供。Electron 会持续关注这些项目,为我们的用户提供新的 JavaScript 功能、性能改进和安全修复。以下每个软件包在 Electron 6 中都有一个主要版本升级:
¥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 6:
-
Chromium
76.0.3809.88
-
Node.js
12.4.0
-
V8
7.6.303.22
此版本还包含对 Electron API 的改进。发行说明 有更完整的列表,但以下是重点内容:
¥This release also includes improvements to Electron's APIs. The release notes have a more complete list, but here are the highlights:
Promisification
Electron 6.0 延续了 5.0 版中启动的 initiative 现代化升级,以增强对 Promise 的支持。
¥Electron 6.0 continues the modernization initiative started in 5.0 to improve Promise support.
这些函数现在返回 Promises,并且仍然支持旧版基于回调的调用:
¥These functions now return Promises and still support older callback-based invocation:
-
contentTracing.getCategories()
#16583 -
contentTracing.getCategories()
#16583 -
contentTracing.getTraceBufferUsage()
#16600 -
contents.executeJavaScript()
#17312 -
cookies.flushStore()
#16464 -
cookies.get()
#16464 -
cookies.remove()
#16464 -
cookies.set()
#16464 -
dialog.showCertificateTrustDialog()
#17181 -
inAppPurchase.getProducts()
#17355 -
inAppPurchase.purchaseProduct()
#17355 -
netLog.stopLogging()
#16862 -
session.clearAuthCache()
#17259 -
session.clearCache()
#17185 -
session.clearHostResolverCache()
#17229 -
session.clearStorageData()
#17249 -
session.getBlobData()
#17303 -
session.getCacheSize()
#17185 -
session.resolveProxy()
#17222 -
session.setProxy()
#17222 -
webContents.hasServiceWorker()
#16535 -
webContents.printToPDF()
#16795 -
webContents.savePage()
#16742 -
webFrame.executeJavaScript()
#17312 -
webFrame.executeJavaScriptInIsolatedWorld()
#17312 -
webviewTag.executeJavaScript()
#17312
这些函数现在有两种形式:同步和基于 Promise 的异步:
¥These functions now have two forms, synchronous and Promise-based asynchronous:
-
dialog.showMessageBox()
/dialog.showMessageBoxSync()
#17298 -
dialog.showOpenDialog()
/dialog.showOpenDialogSync()
#16973 -
dialog.showSaveDialog()
/dialog.showSaveDialogSync()
#17054
这些函数现在返回 Promises:
¥These functions now return Promises:
app.dock.show()
#16904
Electron Helper (Renderer).app
、Electron Helper (GPU).app
和 Electron Helper (Plugin).app
¥Electron Helper (Renderer).app
, Electron Helper (GPU).app
and Electron Helper (Plugin).app
为了启用 强化运行时(它会限制可写可执行内存以及加载由不同 Team ID 签名的代码等操作),需要为 Helper 授予特殊的代码签名权限。
¥In order to enable the hardened runtime, which restricts things like writable-executable memory and loading code signed by a different Team ID, special code signing entitlements needed to be granted to the Helper.
为了将这些权限限定在需要它们的进程类型内,Chromium added 提供了三个新的 Helper 应用变体:一个用于渲染器 (Electron Helper (Renderer).app
),一个用于 GPU 进程 (Electron Helper (GPU).app
),一个用于插件 (Electron Helper (Plugin).app
)。
¥To keep these entitlements scoped to the process types that require them, Chromium added
three new variants of the Helper app: one for renderers (Electron Helper (Renderer).app
), one for the GPU process (Electron Helper (GPU).app
) and one for plugins (Electron Helper (Plugin).app
).
使用 electron-osx-sign
对其 Electron 应用进行协同设计的用户无需对其构建逻辑进行任何更改。如果你使用自定义脚本对应用进行代码签名,则应确保三个新的辅助应用已正确进行代码签名。
¥Folks using electron-osx-sign
to codesign their Electron app shouldn't have to make any changes to their build logic.
If you're codesigning your app with custom scripts, you should ensure
that the three new Helper applications are correctly codesigned.
为了正确使用这些新的 Helper 打包你的应用,你需要使用 electron-packager@14.0.4
或更高版本。如果你使用的是 electron-builder
,则应该关注 这个问题 来跟踪对这些新助手的支持情况。
¥In order to package your application correctly with these new helpers you need to be using electron-packager@14.0.4
or higher. If you are using electron-builder
you should follow this issue to track support for these new helpers.
重大变化
¥Breaking Changes
-
此版本开始为未来在渲染器进程中加载的原生 Node 模块必须是 N-API 或 上下文感知 的要求奠定基础。此次变更的原因是性能提升、安全性增强以及维护工作量减少。请阅读 这个问题 中包括建议的时间表在内的完整详情。此更改预计将在 Electron v11 中完成。
¥This release begins laying the groundwork for a future requirement that native Node modules loaded in the renderer process be either N-API or Context Aware. The reasons for this change are faster performance, stronger security, and reduced maintenance workload. Read the full details including the proposed timeline in this issue. This change is expected to be completed in Electron v11.
-
net.IncomingMessage
的标头包含 略有改动,以便与 Node.js 行为 更加匹配,尤其是在set-cookie
的值以及如何处理重复标头方面。#17517。¥
net.IncomingMessage
headers have changed slightly to more closely match Node.js behavior, particularly with the value ofset-cookie
and how duplicate headers are handled. #17517. -
shell.showItemInFolder()
现在返回 void 并且是异步调用。#17121¥
shell.showItemInFolder()
now returns void and is an asynchronous call. #17121 -
现在,应用在使用
app.getPath('log')
之前必须通过调用新函数app.setAppLogPath()
明确设置日志路径。#17841¥Apps must now explicitly set a log path by calling the new function
app.setAppLogPath()
before usingapp.getPath('log')
. #17841
3.x.y 支持终止
¥End of Support for 3.x.y
根据我们的 支持政策,3.x.y 版本已达到生命周期终点。建议开发者和应用升级到较新版本的 Electron。
¥Per our support policy, 3.x.y has reached end of life. Developers and applications are encouraged to upgrade to a newer version of Electron.
应用反馈计划
¥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 的新主要版本及其组件的新版本。暂定 7.0.0 计划 模块列出了 Electron 7 开发生命周期中的关键日期。此外,查看我们的版本控制文档 提供了有关 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 7.0.0 schedule maps out key dates in the Electron 7 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.