Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out caller function in Angular2, Typescript

Tags:

angular

ionic2

I want to find out the caller function of a particular function in my angular2/ionic2 project.. No luck with

arguments.callee.caller.toString()

Any idea?

like image 610
Mark Timothy Avatar asked Oct 17 '16 10:10

Mark Timothy


2 Answers

I know this is a bit late, but I just had the same problem and hopefully this will help someone else.

You can produce a stack trace by doing

console.log((new Error).stack);

That will show you which function called your particular function

like image 69
Josh Avatar answered Sep 25 '22 01:09

Josh


You can simply check Call Stack in your browser dev tools. Take for example Chrome Dev Tools Stack Trace

like image 24
Denis Avatar answered Sep 24 '22 01:09

Denis