Merge pull request #11224 from electron/browser-view-window

feature: Add `BrowserWindow.fromBrowserView()`
This commit is contained in:
Charles Kerr 2017-11-23 14:41:36 +01:00 committed by GitHub
commit 9c217fc6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 1 deletions

View file

@ -144,6 +144,14 @@ BrowserWindow.fromWebContents = (webContents) => {
}
}
BrowserWindow.fromBrowserView = (browserView) => {
for (const window of BrowserWindow.getAllWindows()) {
if (window.getBrowserView() === browserView) return window
}
return null
}
BrowserWindow.fromDevToolsWebContents = (webContents) => {
for (const window of BrowserWindow.getAllWindows()) {
const {devToolsWebContents} = window