dagda1
dagda1

Reputation: 28810

arguments.callee alternative

As arguments.callee is going to be deprecated, what would I use of instead of arguments.callee` in the following expression:

var self = this;

this.async(function(){
  if(test()){
    then();
  }else{
    self.async(arguments.callee);
  }
});

Upvotes: 7

Views: 1669

Answers (1)

Florian Salihovic
Florian Salihovic

Reputation: 3951

This should work. But i'm not sure if it works in all browsers.

var self = this;

this.async(function someMethod(){
  if(test()){
    then();
  }else{
    self.async(someMethod);
  }
});

Upvotes: 5

Related Questions