简体   繁体   中英

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);
  }
});

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);
  }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM