I'm stuck on a particular point with my Electron app:
When I open the devTools, I call mainWindow.webContents.openDevTools()
from the app's menu. It's working fine on mainWindow
.
The problem appears on child windows, opened by window.open()
: the app menu is still working on every window, but it always call mainWindow's devtools (which is normal, since I told it to do so), where I would like to get current window's ones.
So I wonder if there is a way to call something like currentWindow.webContents.openDevTools()
? I found nothing in the documentation nor on SO nor by googling, so I guess I might haev missed something.
Let me precise a few things:
After a bit more reading, I just found out that BrowserWindow.getFocusedWindow()
is exactly what I was looking for.
So in my app menu, I juste call BrowserWindow.getFocusedWindow().webContents.openDevTools()
, and it works as I expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With