arguments.callee.caller... how to get 'this' reference of a caller object?
I have a configuration object which may c开发者_运维百科ontainer scope property and may not and I pass it to my function. This function creates some callback functions and applies 'scope' property to them. I want to force this function to provide the scope even if it is not actually specified - to get 'this' reference of a caller, something like this:
function someFunc (config)
{
var scope = config.scope ? config.scope : arguments.callee.caller... (?);
config.preAction.apply(scope);
}
Is it actually possible?
Just as you assumed in your comment, the answer is that it is impossible. JavaScript is simply not introspective enough.
精彩评论