Open ghost opened 8 years ago
Why? Not sure I understand the use-case.
To Debug external Websources. In my case an Ionic WebApp
But you can just use the shortcut or enable the option to open devtools automatically on startup. Maybe it would help if you provided an example usage.
The shortcut openes only the DevTools from electron.BrowserWindow. In the Renderer Process you can use the Electron Webview tag see api docs
An Example:
Main process
let win = new BrowserWindow({width: 800, height: 600, show: false});
win.on('closed', () => {
win = null;
});
win.loadURL('file://index.html');
win.show();
Renderer Process: index.html
<html>
<body>
<webview id="view" src="web.whatsapp.com" />
<script>
const {ipcRenderer} = require('electron');
$('#view')[0].addEventListener('dom-ready', function () {
ipcRenderer.on('dev-tools-opened', (event, arg) => {
$('#view')[0].openDevTools();
});
});
</script>
</body>
</html>
The dev-tools-opened Signal is fired from the openDevTools method
Thanks for elaborating. Makes sense. I wonder though if there's any way we can handle that more automagically. Like maybe allow you to pass in the webview
DOM element to electron-debug and have it handled for you? Ideas?
Trying to solve https://github.com/parro-it/debug-menu/issues/6 I made some experiment using webContents.getFocusedWebContents()
. It return webContents
of webviews when they are focused.
I remember of this issue... I think it could be elegantly solved using getFocusedWebContents
.
@parro-it I followed your advice and implemented #64, thanks :)
A useful feature it would be if a signal is sent to the renderer process. Because then you can decide in Electron-Webview whether this also wants to open the DevTools.