debug.js icon indicating copy to clipboard operation
debug.js copied to clipboard

JS Debugger with breakpoints

Open DarkCat09 opened this issue 3 years ago • 1 comments

Is it possible to make a javascript debugger as in Developer Tools where you can add breakpoint and view all variables values?
I think this can be done with proxy server which will insert code like dbg.breakpoint(); before lines where user clicked to add breakpoint.

DarkCat09 avatar Aug 02 '22 06:08 DarkCat09

It seems difficult to implement it directly in the form of breakpoints, but you can do something similar.

The debug.js has a function "log.p()" which can show the variable values. Prepare a function yourself for debugging like:

function breakpoint() {
  log.p(SOME_VALIABLE_YOU_WANT_TO_VIEW_1);
  log.p(SOME_VALIABLE_YOU_WANT_TO_VIEW_2);
  log.p(SOME_VALIABLE_YOU_WANT_TO_VIEW_3);
}

and then insert the function before lines where you want to debug.

takashiharano avatar Aug 02 '22 10:08 takashiharano