跳转到主内容

Electron 12.0.0

· 阅读时间:约 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
  • 将Nodejs版本从12更新至14 #23249
  • Added a new webFrameMain API for accessing sub-frames of a WebContents instance from the main process. #25464
  • contextIsolationworldSafeExecuteJavaScript 的默认值更改为 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:
    • 添加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:

  • 弃用 remote 模块。 它被 @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.