electron/lib/browser/api/browser-view.js
2020-03-20 13:28:31 -07:00

16 lines
407 B
JavaScript

'use strict';
const { EventEmitter } = require('events');
const { BrowserView } = process.electronBinding('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;