asarfuckery/electronasar/development/browser/api/browser-view.js

17 lines
395 B
JavaScript
Raw Normal View History

2019-01-17 18:22:05 +00:00
'use strict'
const { EventEmitter } = require('events')
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 view
}
return null
}
module.exports = BrowserView