পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, February 16, 2017

Electron - Debugging

We have 2 processes, as we discussed in the start of the tutorial, that run our application. The main process and the renderer process.
Since the renderer process is the one being executed in our browser window, we can use Chrome Devtools to debug it. To open DevToolsuse the shortcut "Ctrl+Shift+I" or the <F12> key. You can check out how to use devtools here.

When you open the DevTools, your app would look like this:
DevTools

Debugging the Main Process

The DevTools in an Electron browser window can only debug JavaScript that’s executed in that window (i.e. the web pages). To debug JavaScript that’s executed in the main process you will need to use an external debugger and launch Electron with the --debug or --debug-brk switch.
Electron will listen for V8 debugger protocol messages on the specified port, an external debugger will need to connect on this port. The default port is 5858.
Run your app using the following:
$ electron --debug=5858 ./main.js
Now you'll need a debugger that supports the V8 debugger protocol. You could use VSCode or node-inspector for this purpose. For example, lets set up VSCode for this purpose. Follow the below steps to set it up:
Download and install VSCode. Open your Electron project in VSCode.
Add a file .vscode/launch.json with the following configuration:
{
   "version": "1.0.0",
   "configurations": [
      {
         "name": "Debug Main Process",
         "type": "node",
         "request": "launch",
         "cwd": "${workspaceRoot}",
         "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
         "program": "${workspaceRoot}/main.js"
      }
   ]
}
Note: For Windows, use "${workspaceRoot}/node_modules/.bin/electron.cmd" for runtimeExecutable.
Set some breakpoints in main.js, and start debugging in the Debug View. When you hit the breakpoints, the screen will look something like this:
Debugger The VSCode debugger is very powerful and will help you rectify errors quickly. You also have other options like node-inspector for debugging electron apps.

No comments:

Post a Comment