2019-06-20 21:19:08 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const { EventEmitter } = require('events')
|
|
|
|
const { BrowserView } = process.atomBinding('browser_view')
|
|
|
|
|
|
|
|
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype)
|
|
|
|
|
2019-06-16 20:19:06 +00:00
|
|
|
BrowserView.fromWebContents = (webContents) => {
|
2019-06-20 21:19:08 +00:00
|
|
|
for (const view of BrowserView.getAllViews()) {
|
|
|
|
if (view.webContents.equal(webContents)) return view
|
|
|
|
}
|
|
|
|
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BrowserView
|