Skip to main content

Electron 3.0.0

· 9 min read

Electron 团队非常高兴地宣布,Electron 3 的第一个稳定版本现已从 electronjs.orgnpm install electron@latest 版本发布!它充满了升级、修复和新功能,我们迫不及待地想看看你用它们构建了什么。以下是此版本的详细信息,欢迎你在探索过程中提供反馈。

¥The Electron team is excited to announce that the first stable release of Electron 3 is now available from electronjs.org and via npm install electron@latest! It's jam-packed with upgrades, fixes, and new features, and we can't wait to see what you build with them. Below are details about this release, and we welcome your feedback as you explore.


发布流程

¥Release Process

v3.0.0 的开发过程中,我们试图通过规范化渐进式 Beta 版本的反馈进度,更基于经验地定义稳定版本的标准。如果没有我们的 应用反馈计划 合作伙伴在 Beta 测试周期中提供的早期测试和反馈,v3.0.0 不可能实现。感谢 Atlassian、Atom、Microsoft Teams、Oculus、OpenFin、Slack、Symphony、VS Code 以及其他项目成员的辛勤工作。如果你想参与未来的 Beta 版本,请发送电子邮件至 info@electronjs.org

¥As we undertook development of v3.0.0, we sought to more empirically define criteria for a stable release by formalizing the feedback progress for progressive beta releases. v3.0.0 would not have been possible without our App Feedback Program partners, who provided early testing and feedback during the beta cycle. Thanks to Atlassian, Atom, Microsoft Teams, Oculus, OpenFin, Slack, Symphony, VS Code, and other program members for their work. If you'd like to participate in future betas, please mail us at info@electronjs.org.

变更/新功能

¥Changes / New Features

Electron 工具链的几个重要部分发生了重大变化,包括 Chrome v66.0.3359.181、Node v10.2.0 和 V8 v6.6.346.23.

¥Major bumps to several important parts of Electron's toolchain, including Chrome v66.0.3359.181, Node v10.2.0, and V8 v6.6.346.23.

  • [#12656] 功能:app.isPackaged

    ¥[#12656] feat: app.isPackaged

  • [#12652] 功能:app.whenReady()

    ¥[#12652] feat: app.whenReady()

  • [#13183] 功能:process.getHeapStatistics()

    ¥[#13183] feat: process.getHeapStatistics()

  • [#12485] 功能:win.moveTop() 会将窗口 Z 轴顺序移至顶部

    ¥[#12485] feat: win.moveTop() to move window z-order to top

  • [#13110] 功能:TextField 和 Button API

    ¥[#13110] feat: TextField and Button APIs

  • [#13068] 功能:用于动态日志控制的 netLog API

    ¥[#13068] feat: netLog API for dynamic logging control

  • [#13539] 功能:在沙盒渲染器中启用 webview

    ¥[#13539] feat: enable webview in sandbox renderer

  • [#14118] 功能:fs.readSync 现在支持处理海量文件。

    ¥[#14118] feat: fs.readSync now works with massive files

  • [#14031] 功能:node fs 封装器使 fs.realpathSync.nativefs.realpath.native 可用

    ¥[#14031] feat: node fs wrappers to make fs.realpathSync.native and fs.realpath.native available

重大 API 更改

¥Breaking API changes

  • [#12362] 功能:菜单项顺序控制更新

    ¥[#12362] feat: updates to menu item order control

  • [#13050] 重构:删除了已记录的弃用 API

    ¥[#13050] refactor: removed documented deprecated APIs

    • 有关更多详细信息,请参阅 docs

      ¥See docs for more details

  • [#12477] 重构:移除了 did-get-response-detailsdid-get-redirect-request 事件。

    ¥[#12477] refactor: removed did-get-response-details and did-get-redirect-request events

  • [#12655] 功能:默认禁用拖放导航

    ¥[#12655] feat: default to disabling navigating on drag/drop

  • [#12993] 功能:需要 Node v4.x 或更高版本,并使用 electron npm 模块。

    ¥[#12993] feat: Node v4.x or greater is required use the electron npm module

  • [#12008 #12140 #12503 #12514 #12584 #12596 #12637 #12660 #12696 #12716 #12750 #12787 #12858] 重构:NativeWindow

    ¥[#12008 #12140 #12503 #12514 #12584 #12596 #12637 #12660 #12696 #12716 #12750 #12787 #12858] refactor: NativeWindow

  • [#11968] 重构:menu.popup()

    ¥[#11968] refactor: menu.popup()

  • [#8953] 功能:不再使用 JSON 发送 ipcRenderer.sendSync 的结果

    ¥[#8953] feat: no longer use JSON to send the result of ipcRenderer.sendSync

  • [#13039] 功能:默认忽略 URL 后的命令行参数

    ¥[#13039] feat: default to ignore command line arguments following a URL

  • [#12004] 重构:将 api::Window 重命名为 api::BrowserWindow

    ¥[#12004] refactor: rename api::Window to api::BrowserWindow

  • [#12679] 功能:视觉缩放功能现已默认关闭

    ¥[#12679] feat: visual zoom now turned off by default

  • [#12408] 重构:将应用命令 media-play_pause 重命名为 media-play-pause

    ¥[#12408] refactor: rename app-command media-play_pause to media-play-pause

苹果系统

¥macOS

  • [#12093] 功能:工作区通知支持

    ¥[#12093] feat: workspace notifications support

  • [#12496] 功能:tray.setIgnoreDoubleClickEvents(ignore) 会忽略托盘双击事件。

    ¥[#12496] feat: tray.setIgnoreDoubleClickEvents(ignore) to ignore tray double click events.

  • [#12281] 功能:macOS 上的鼠标前进功能

    ¥[#12281] feat: mouse forward functionality on macOS

  • [#12714] 功能:屏幕锁定/解锁事件。

    ¥[#12714] feat: screen lock / unlock events

Windows

  • [#12879] 功能:添加了 DIP 与屏幕坐标之间的转换

    ¥[#12879] feat: added DIP to/from screen coordinate conversions

注意事项:运行此版本后切换到旧版本的 Electron 将需要你清除用户数据目录,以避免旧版本崩溃。你可以通过运行 console.log(app.getPath("userData")) 获取用户数据目录,或查看 docs 了解更多详细信息。

¥Nota Bene: Switching to an older version of Electron after running this version will require you to clear out your user data directory to avoid older versions crashing. You can get the user data directory by running console.log(app.getPath("userData")) or see docs for more details.

错误修复

¥Bug Fixes

  • [#13397] 修复:fs.statSyncNoException 抛出异常的问题

    ¥[#13397] fix: issue with fs.statSyncNoException throwing exceptions

  • [#13476, #13452] 修复:使用 jQuery 加载网站时崩溃

    ¥[#13476, #13452] fix: crash when loading site with jquery

  • [#14092] 修复:net::ClientSocketHandle 析构函数崩溃

    ¥[#14092] fix: crash in net::ClientSocketHandle destructor

  • [#14453] 修复:立即通知焦点变化,而不是在下一个 tick 通知

    ¥[#14453] fix: notify focus change right away rather not on next tick

苹果系统

¥MacOS

  • [#13220] 修复:在 <input file="type"> 打开文件对话框中允许选择 bundles 的问题

    ¥[#13220] fix: issue allowing bundles to be selected in <input file="type"> open file dialog

  • [#12404] 修复:使用异步对话框时阻塞主进程的问题

    ¥[#12404] fix: issue blocking main process when using async dialog

  • [#12043] 修复:上下文菜单点击回调

    ¥[#12043] fix: context menu click callback

  • [#12527] 修复:重用触控栏项目时发生事件泄漏

    ¥[#12527] fix: event leak on reuse of touchbar item

  • [#12352] 修复:托盘标题崩溃

    ¥[#12352] fix: tray title crash

  • [#12327] 修复:不可拖动区域

    ¥[#12327] fix: non-draggable regions

  • [#12809] 修复:防止菜单在打开时更新

    ¥[#12809] fix: to prevent menu update while it's open

  • [#13162] 修复:托盘图标边界不允许负值

    ¥[#13162] fix: tray icon bounds not allowing negative values

  • [#13085] 修复:托盘标题高亮时不反转

    ¥[#13085] fix: tray title not inverting when highlighted

  • [#12196] 修复:enable_run_as_node==false 时 Mac 版本

    ¥[#12196] fix: Mac build when enable_run_as_node==false

  • [#12157] 修复:解决了无框窗口与 Vibrancy 相关的其他问题

    ¥[#12157] fix: additional issues on frameless windows with vibrancy

  • [#13326] 修复:调用 app.removeAsDefaultProtocolClient 后将 mac 协议设置为 None

    ¥[#13326] fix: to set mac protocol to none after calling app.removeAsDefaultProtocolClient

  • [#13530] 修复:MAS 构建中私有 API 的使用不正确

    ¥[#13530] fix: incorrect usage of private APIs in MAS build

  • [#13517] 修复:tray.setContextMenu 崩溃

    ¥[#13517] fix: tray.setContextMenu crash

  • [#14205] 修复:即使设置了 defaultId,在对话框中按下 Esc 键也会关闭对话框。

    ¥[#14205] fix: pressing escape on a dialog now closes it even if defaultId is set

Linux

  • [#12507] 修复:BrowserWindow.focus() 用于屏幕外窗口

    ¥[#12507] fix: BrowserWindow.focus() for offscreen windows

其他说明

¥Other Notes

  • PDF 查看器目前无法运行,但正在改进中,很快就会恢复运行。

    ¥PDF Viewer is currently not working but is being worked on and will be functional once again soon

  • TextFieldButton API 处于实验阶段,因此默认关闭。

    ¥TextField and Button APIs are experimental and are therefore off by default

    • 可以通过 enable_view_api 构建标志启用它们

      ¥They can be enabled with the enable_view_api build flag

下一步计划

¥What's Next

Electron 团队将继续致力于定义我们的流程,以实现更快速、更顺畅的升级,我们力求最终与 Chromium、Node 和 V8 的开发节奏保持一致。

¥The Electron team continues to work on defining our processes for more rapid and smooth upgrades as we seek to ultimately maintain parity with the development cadences of Chromium, Node, and V8.