gpt4 book ai didi

electron - 想要在 Electron 应用程序中获取打开的窗口数?

转载 作者:行者123 更新时间:2023-12-04 08:03:08 35 4
gpt4 key购买 nike

Electron 是否提供任何 API 来获取当前打开的 BrowserWindow 计数?

我没有通过应用程序 API 找到该方法。或者我能得到现在有多少个 renderProcess 正在运行?

最佳答案

您可以使用 BrowserWindow.getAllWindows 并使用 isVisible每个实例可选:

  let count = BrowserWindow.getAllWindows()
.filter(b => {
return b.isVisible()
})
.length

对于渲染器进程的数量(不一定与 BrowserWindow 计数相同),您可以使用 webContents.getAllWebContents()

关于electron - 想要在 Electron 应用程序中获取打开的窗口数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47493434/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com