mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
🔧 BrowserView.fromWebContents()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user