🔧 BrowserView.fromWebContents()

This commit is contained in:
Felix Rieseberg 2017-11-22 16:59:00 -08:00
parent 3cb062b3d6
commit 4d18cbe728

View file

@ -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