Skip to content

Commit ebbecce

Browse files
📝 Document debugging
1 parent e986375 commit ebbecce

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Application Debugging
2+
3+
Whenever your Electron application is not behaving the way you wanted it to,
4+
an array of debugging tools might help you find coding errors, performance
5+
bottlenecks, or optimization opportunities.
6+
7+
## Renderer Process
8+
9+
The most comprehensive tool to debug individual renderer processes are the
10+
Chromium Developer Tools. They are available for all renderer processes,
11+
including instances of `BrowserWindow`, `BrowserView`, and `WebView`. You
12+
can open them programmatically by calling the `openDevTools()` API on the
13+
`webContents` of the instance:
14+
15+
```javascript
16+
const { BrowserWindow } = require('electron')
17+
18+
let win = new BrowserWindow()
19+
win.webContents.openDevTools()
20+
```
21+
22+
Google offers [excellent documentation for their developer tools][devtools].
23+
We recommend that you make yourself familiar with them - they are usually one
24+
of the most powerful utilities in any Electron Developer's tool belt.
25+
26+
## Main Process
27+
28+
Debugging the main process is a bit trickier, since you cannot simply open
29+
developer tools for them. The Chromium Developer Tools can [be used
30+
to debug Electron's main process][node-inspect] thanks to a closer collaboration
31+
between Google / Chrome and Node.js, but you might encounter oddities like
32+
`require` not being present in the console.
33+
34+
For more information, see the [Debugging the Main Process documentation][main-debug].
35+
36+
[node-inspect]: https://nodejs.org/en/docs/inspector/
37+
[devtools]: https://developer.chrome.com/devtools
38+
[main-debug]: ./debugging-main-process.md

0 commit comments

Comments
 (0)