🔧 BrowserView.fromWebContents()
This commit is contained in:
parent
3cb062b3d6
commit
4d18cbe728
1 changed files with 8 additions and 0 deletions
|
@ -5,4 +5,12 @@ const {BrowserView} = process.atomBinding('browser_view')
|
|||
|
||||
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype)
|
||||
|
||||
BrowserView.fromWebContents = (webContents) => {
|
||||
for (const view of BrowserView.getAllViews()) {
|
||||
if (view.webContents.equal(webContents)) return window
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = BrowserView
|
||||
|
|
Loading…
Reference in a new issue