The current implementation supports two major scenarios:
- Start debugging - starts an application with the debugger enabled
- Attach/Detach debugger - attach/detach the debugger to a running application
The following command will build, deploy and run the application with the debugger attached:
tns debug android
Behind the scenes the
debug command will build and start the target application and then it will find an available port and enable V8's debugger on that port. Finally, you'll get a url starting with
chrome-devtools:// to copy/paste into Chrome to start the debug session.
- Breakpoint debugging, stepping
- Inline source maps support for transpiled code
- Console evaluation
debugger sets a V8 breakpointIn the script source. It is equivalent to setting a "manual" breakpoint in the Sources tab of Chrome DevTools.
See this article for more information.
If you have a running application you can attach the debugger with the following command:
tns debug android --start
As in the previous scenario, the
debugcommand will configure the V8 debugger port, forward the port, and output a url to paste into Chrome.
Detaching the debugger is as simple as closing the chrome-devtools tab.
The current implementation has hard-coded 30 seconds timeout for establishing a connection between the command line tool and the device/emulator.