Forum Discussion
I tried this experiment... and here's what I got.
I created the following code:
function root(){ Log.Message(root.caller); } function oneUp(){ Log.Message(oneUp.caller); root(); } function twoUp(){ Log.Message(twoUp.caller); oneUp(); } function top(){ Log.Message(top.caller); twoUp(); }
I then ran the top function. My test log, on completion, looks like this.
If you replace <function>.caller with <function>.caller.name you get just the name of the calling function.
We use Jscript. I have tried a direct implementation of the Javascript call as you suggested, since they are theorhetically just about interchangeable. I have tried .caller before, but it appears there are some differences though.
It doesn't encounter errors. It can't pick up the caller though - it's just null
I thought you'd find it amusing that I also tried ObsoleteFunction().caller - and ended up with a Stackoverflow, doh !
- RUDOLF_BOTHMA6 years agoCommunity Hero
Just to be clear. The call stack would be a nice to have, not a critical - I could use the page picture if needs be (it might slow down the tests massively, so will only add the picture if I have my verbose logging project variable as true :smileyvery-happy:). I won't be spending much time on this myself if it's not a trivial implementation .
- tristaanogre6 years agoEsteemed Contributor
Yeah, the "caller" property is a JavaScript item. I don't think it's available in JScript.
Honestly, I'd consider converting your project to JavaScript. There's a lot more you can do with the full JavaScript implementation.- RUDOLF_BOTHMA6 years agoCommunity Hero
tristaanogre wrote:
Honestly, I'd consider converting your project to JavaScript.
I would if it was within my power to do so...
All that standard reasons for not being able to: More than one product, different teams etc. etc. No legacy stuff though - it's too new :smileytongue:
Related Content
- 5 years ago
- 13 years ago
Recent Discussions
- 2 days ago