Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

arguments.callee alternative

Tags:

javascript

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);
  }
});
like image 777
dagda1 Avatar asked Nov 24 '12 14:11

dagda1


1 Answers

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);
  }
});
like image 114
Florian Salihovic Avatar answered Oct 22 '22 14:10

Florian Salihovic