Electron 12.0.0
Electron 12.0.0 已发布!它包含对 Chromium 89、V8 8.9 和 Node.js 14.16 的升级。我们添加了 remote 模块的更改、contextIsolation 的新默认值、新的 webFrameMain API 以及常规改进。请阅读下文了解更多详情!
¥Electron 12.0.0 has been released! 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. Read below for more details!
Electron 团队非常高兴地宣布 Electron 12.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息,并请分享你的任何反馈!
¥The Electron team is excited to announce the release of Electron 12.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!
显著变化
¥Notable Changes
技术栈变更
¥Stack Changes
-
Chromium
89 -
Node.js
14.16 -
V8
8.9
亮点功能
¥Highlight Features
-
ContextBridge
exposeInMainWorld方法现在可以公开非对象 API。#26834¥The ContextBridge
exposeInMainWorldmethod can now expose non-object APIs. #26834 -
已从 Node 12 升级到 Node 14。#23249
¥Upgraded from Node 12 to Node 14. #23249
-
添加了新的
webFrameMainAPI,用于从主进程访问WebContents实例的子框架。#25464¥Added a new
webFrameMainAPI for accessing sub-frames of aWebContentsinstance from the main process. #25464 -
contextIsolation和worldSafeExecuteJavaScript的默认值现已改为true。#27949 #27502¥The default values of
contextIsolationandworldSafeExecuteJavaScriptare nowtrue. #27949 #27502
请参阅 12.0.0 发行说明 获取新功能和变更的完整列表。
¥See the 12.0.0 release notes for a full list of new features and changes.
重大变化
¥Breaking Changes
-
弃用
remote模块。已被@electron/remote取代。#25293¥Deprecated the
remotemodule. It is replaced by@electron/remote. #25293-
如果你目前正在使用
remote模块,我们已经编写了 迁移到@electron/remote的指南,请点击此处。 模块。¥If you are currently using the
remotemodule, we've written a guide to migrating to@electron/remotehere.
-
-
将
contextIsolation的默认值更改为true。#27949¥Changed the default value of
contextIsolationtotrue. #27949 -
将
worldSafeExecuteJavaScript的默认值更改为true。#27502¥Changed the default value of
worldSafeExecuteJavaScripttotrue. #27502 -
已将
crashReporter.start({ compress })的默认值从false更改为true。#25288¥Changed the default of
crashReporter.start({ compress })fromfalsetotrue. #25288 -
移除 Flash 支持:Chromium 已移除对 Flash 的支持,Flash 也在 Electron 12 中被移除。详细信息请参见 Chromium 的闪存路线图。
¥Removed Flash support: Chromium has removed support for Flash, which was also removed in Electron 12. See Chromium's Flash Roadmap for more details.
-
x86 上的 Chrome 需要 SSE3:Chromium 已移除对 不满足最低 SSE3(流式 SIMD 扩展 3)支持的旧版 x86 CPU 的支持。此支持在 Electron 12 中也被删除。
¥Required SSE3 for Chrome on x86: Chromium has removed support for older x86 CPUs that do not meet a minimum of SSE3 (Streaming SIMD Extensions 3) support. This support was also removed in Electron 12.
有关这些变更和未来变更的更多信息,请参阅 计划中的突发事件变更 页面。
¥More information about these and future changes can be found on the Planned Breaking Changes page.
API 变更
¥API Changes
-
添加了
webFrameMainAPI:webFrameMain模块可用于在现有的WebContents实例中查找框架。这是现有 webFrame API 的主要流程等效部分。更多关于此新 API 的信息,请参阅 此处 和我们的 documentation。¥Added
webFrameMainAPI: ThewebFrameMainmodule can be used to look up frames across existingWebContentsinstances. 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. -
appAPI 变更:¥
appAPI changes:-
为
'child-process-gone'/app.getAppMetrics()添加了非本地化的serviceName。#25975¥Added non-localized
serviceNameto'child-process-gone'/app.getAppMetrics(). #25975 -
添加了新的
app.runningUnderRosettaTranslation属性,用于检测何时在 Apple Silicon 上的 Rosetta 下运行。#26444¥Added new
app.runningUnderRosettaTranslationproperty to detect when running under rosetta on Apple silicon. #26444 -
在
render-process-gone详细信息中添加了exitCode(应用和 Web 内容)。#27677¥Added
exitCodetorender-process-gonedetails (app & webContents). #27677
-
-
BrowserWindowAPI 变更:¥
BrowserWindowAPI changes:-
添加了
BrowserWindow.isTabletMode()API。#25209¥Added
BrowserWindow.isTabletMode()API. #25209 -
在
BrowserWindow中添加了resized(Windows/macOS) 和moved(Windows) 事件。#26216¥Added
resized(Windows/macOS) andmoved(Windows) events toBrowserWindow. #26216 -
添加了新的
system-context-menu事件,用于阻止和覆盖系统上下文菜单。#25795¥Added new
system-context-menuevent to allow preventing and overriding the system context menu. #25795 -
添加
win.setTopBrowserView()以便可以触发BrowserView。#27713¥Added
win.setTopBrowserView()so thatBrowserViews can be raised. #27713 -
添加
webPreferences.preferredSizeMode以允许根据文档的最小大小调整视图大小。#25874¥Added
webPreferences.preferredSizeModeto allow sizing views according to their document's minimum size. #25874
-
-
contextBridgeAPI 变更:¥
contextBridgeAPI changes: -
displayAPI 变更:¥
displayAPI changes: -
extensionsAPI 变更:¥
extensionsAPI changes: -
MenuItemAPI 变更:¥
MenuItemAPI changes: -
netAPI 变更:¥
netAPI changes: -
powerMonitorAPI 变更:¥
powerMonitorAPI changes: -
sessionAPI 变更:¥
sessionAPI changes:-
在
ses.loadExtension()API 中添加了allowFileAccess选项。#27702¥Added
allowFileAccessoption toses.loadExtension()API. #27702 -
为
session.setPermissionRequestHandler添加了display-captureAPI。#27696¥Added
display-captureAPI forsession.setPermissionRequestHandler. #27696 -
在
session.setSSLConfig中添加了disabledCipherSuites选项。#25818¥Added a
disabledCipherSuitesoption tosession.setSSLConfig. #25818 -
已将
extension-loaded、extension-unloaded和extension-ready事件添加到session。#25385¥Added
extension-loaded,extension-unloaded, andextension-readyevents tosession. #25385 -
添加了
session.setSSLConfig()以允许配置 SSL。#25461¥Added
session.setSSLConfig()to allow configuring SSL. #25461 -
添加了在
session.setProxy()中明确指定direct、auto_detect或system模式的支持。#24937¥Added support for explicitly specifying
direct,auto_detectorsystemmodes insession.setProxy(). #24937 -
¥Added Serial API support. #25237
-
添加了用于启用/禁用拼写检查器的 API。#26276
¥Added APIs to enable/disable spell checker. #26276
-
-
shellAPI 变更:¥
shellAPI changes: -
webContentsAPI 变更:¥
webContentsAPI changes:-
在控制台中添加了一个小型控制台提示,以帮助调试渲染器崩溃。#25317
¥Added a small console hint to console to help debug renderer crashes. #25317
-
在 webRequest 处理程序的 detail 对象中添加了
frame和webContents属性。#27334¥Added
frameandwebContentsproperties to the details object in webRequest handlers. #27334 -
添加
webContents.forcefullyCrashRenderer()以强制终止渲染器进程,以帮助恢复挂起的渲染器。#25580¥Added
webContents.forcefullyCrashRenderer()to forcefully terminate a renderer process to assist with recovering a hung renderer. #25580 -
为渲染器创建的子窗口添加了
setWindowOpenHandlerAPI,并弃用了new-window事件。#24517¥Added
setWindowOpenHandlerAPI for renderer-created child windows, and deprecatenew-windowevent. #24517
-
-
webFrameAPI 变更:¥
webFrameAPI changes:
移除/弃用的变更
¥Removed/Deprecated Changes
以下 API 已被删除或弃用:
¥The following APIs have been removed or are now deprecated:
-
弃用
remote模块。已被@electron/remote取代。#25293¥Deprecated the
remotemodule. It is replaced by@electron/remote. #25293 -
移除已弃用的
crashReporterAPI。#26709¥Removed deprecated
crashReporterAPIs. #26709 -
从打包应用中的默认 '帮助' 菜单中移除了指向 Electron 网站的链接。#25831
¥Removed links to the Electron website from the default 'Help' menu in packaged apps. #25831
9.x.y 停止支持
¥End of Support for 9.x.y
根据项目的 支持政策 声明,Electron 9.x.y 已终止支持。建议开发者和应用升级到较新版本的 Electron。
¥Electron 9.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.
下一步计划
¥What's Next
短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。虽然我们谨慎地不对发布日期做出承诺,但我们计划大约每季度发布一次 Electron 的新主要版本及其组件的新版本。暂定 13.0.0 计划 列出了 Electron 13.0 开发生命周期中的关键日期。此外,查看我们的版本控制文档 提供了有关 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 13.0.0 schedule maps out key dates in the Electron 13.0 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.