feat: add TopLevelWindow.setContentView API

This commit is contained in:
Cheng Zhao 2018-05-08 14:47:26 +09:00
parent 2b24b26e59
commit bb2715e7a5
10 changed files with 56 additions and 18 deletions

View file

@ -1,7 +1,7 @@
'use strict'
const electron = require('electron')
const {ipcMain, TopLevelWindow} = electron
const {ipcMain, WebContentsView, TopLevelWindow} = electron
const {BrowserWindow} = process.atomBinding('window')
const v8Util = process.atomBinding('v8_util')
@ -14,6 +14,9 @@ BrowserWindow.prototype._init = function () {
// Avoid recursive require.
const {app} = electron
// Create WebContentsView.
this.setContentView(new WebContentsView(this.webContents))
// Make new windows requested by links behave like "window.open"
this.webContents.on('-new-window', (event, url, frameName, disposition,
additionalFeatures, postData,