can an actionscript function find out its own name?

前端 未结 7 999
借酒劲吻你
借酒劲吻你 2020-12-16 01:06

given the following

function A(b:Function)   { }

If function A(), can we determine the name of the function being passed in as parameter \'

相关标签:
7条回答
  • 2020-12-16 01:35

    Use arguments.callee with toString() and match in general:

    function foo(){return arguments.callee.toString().match(/\s\w+/).toString()}
    

    References

    • arguments callee method

    • Tracing Function Arguments

    0 讨论(0)
提交回复
热议问题