Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript function full path

Tags:

javascript

For example with explorer debug tools I've stopped inside some function using breakpoint ('DevTools' for example in Chrome).

Is it possible to know full path from that function context till Global context (window object)?

Like:

window.***.***.***.***.CustomFunction()

Is it possible?

like image 307
CroMagnon Avatar asked Dec 13 '25 07:12

CroMagnon


1 Answers

Is it possible to know full path from that function context till Global context (window object)?

If the function execution has not started from the window context (e.g. a function invoked from inside a closure), then no, the full path of its context will never reach the window.

As others have pointed out in the comments, your best bet is to use the Call Stack panel in conjunction with the Scope panel, in the Sources section of your dev tools.

You will get, literally, every bit of information you may ever want about a specific step in the callstack; how it came to be invoked, all the way to the very first trigger, and you can check all its scopes and what variables and functions it uses from each scope.

Call stack

You can even trace the stack from asynchronous calls, by enabling the async option. It's pretty great.

enter image description here

like image 159
Dimitris Karagiannis Avatar answered Dec 15 '25 20:12

Dimitris Karagiannis