fix: print warning after DOM is created
This commit is contained in:
parent
714f3ffd29
commit
8716f718a9
3 changed files with 20 additions and 2 deletions
|
@ -54,7 +54,13 @@ BrowserWindow.prototype._init = function () {
|
|||
'"nativeWindowOpen" option will cause memory leaks, please turn off ' +
|
||||
'the "nodeIntegration" option.\\n' +
|
||||
'See https://github.com/electron/electron/pull/15076 for more.'
|
||||
this.webContents.executeJavaScript(`console.warn('${message}')`)
|
||||
// console is only available after DOM is created.
|
||||
const printWarning = () => this.webContents.executeJavaScript(`console.warn('${message}')`)
|
||||
if (this.webContents.isDomReady()) {
|
||||
printWarning()
|
||||
} else {
|
||||
this.webContents.once('dom-ready', printWarning)
|
||||
}
|
||||
}
|
||||
|
||||
let {url, frameName} = urlFrameName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue