这可能让我眼前一亮,但给出了WebContents我如何找到相应的BrowserWindow?
在我的头顶我可以做到
const windows = BrowserWindow.getAllWindows();
const ndx = windows.indexOf(someWebContents);
const window = windows[ndx];
Run Code Online (Sandbox Code Playgroud)
有没有更简单的方法?
小智 7
这个BrowserWindow静态方法似乎是最直接的方法:
BrowserWindow.fromWebContents(webContents)
返回 BrowserWindow - 拥有给定 webContents 的窗口。
| 归档时间: |
|
| 查看次数: |
3288 次 |
| 最近记录: |