can an actionscript function find out its own name?

前端 未结 7 1038
借酒劲吻你
借酒劲吻你 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

提交回复
热议问题