I have a JavaScript function that needs to behave differently if is called from another function. I have no control of the invocation of my function, so I can't do that based on parameter passing.
So, I was planning on identifying which function is doing the call, and behaving differently if that call comes from this specific function. To do that, I found these approaches:
- Get the reference through arguments.caller, but I found it is a soon-to-be deprecated attribute.
- Get the reference through Function.caller, but it is not a standard.
So every approach I found seems to have a pitfall. Which is the recommended approach for that? By the way, I'm using ExtJS Framework, maybe there's an specific way for doing that there.