659e79fc08
* refactor: prevent consistent early exception * Use _linkedBinding where possible * Remove dead electronBinding
15 lines
424 B
TypeScript
15 lines
424 B
TypeScript
import { EventEmitter } from 'events';
|
|
|
|
const { BrowserView } = process._linkedBinding('electron_browser_browser_view');
|
|
|
|
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype);
|
|
|
|
BrowserView.fromWebContents = (webContents: Electron.WebContents) => {
|
|
for (const view of BrowserView.getAllViews()) {
|
|
if (view.webContents.equal(webContents)) return view;
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
export default BrowserView;
|