2

I use Google Chrome and its webkit developer tools to write/debug my JavaScript.

I want to be able to see what function is currently executing, and I can't seem to find a way to do this. Seems like it everyone would need this. Please help...

PS. Currently I do console.log ('Function X is running'), on top of every function... but that doesn't seem very efficient. At least I can tell in console what's executing.

Tom Kruk
  • 109
  • 1
  • 5

1 Answers1

1

I agree with the other commenters in that this is probably not the way to go about knowing what your code is doing. If you can't understand it by reading it, or stepping through with breakpoints (which browser dev tools give you), then you're going to have a really though time in general with that code, and it warrants refactoring etc.

Also, adding console.log in certain places is indeed probably the quickest and easiest. Use the answers in here to get the currently executing function name.

Or you could look at doing it this way if you're not adding functions later. I also think this could be improved to work in all cases.

Using a JS AOP framework again is overkill, but could work in theory.

Lastly, if none of that works for you for some reason, this product may be what you're looking for: http://www.compuware.com/application-performance-management/dynatrace-ajax-javascript-dom.html

Community
  • 1
  • 1
Nik
  • 2,718
  • 23
  • 34