electron/spec/fixtures/pages/webview-devtools.html
2017-02-06 10:34:29 -08:00

30 lines
949 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<webview nodeintegration src="./a.html"></webview>
<script>
var wv = document.querySelector('webview')
wv.addEventListener('dom-ready', () => {
const webContents = wv.getWebContents()
webContents.on('devtools-opened', function () {
var showPanelIntevalId = setInterval(function () {
if (webContents.devToolsWebContents) {
webContents.devToolsWebContents.executeJavaScript('(' + (function () {
var lastPanelId = UI.inspectorView._tabbedPane._tabs.peekLast().id
UI.inspectorView.showPanel(lastPanelId)
}).toString() + ')()')
} else {
clearInterval(showPanelIntevalId)
}
}, 100)
})
wv.openDevTools()
})
</script>
</script>
</body>
</html>