I have a class, with 'tax' var. I need fill this var when the request is complete.
The problem is that if I return into callback, this return is for callback function, not for my method, and if I return in a taxMethod, it is executed before that I have the data, because is async and request async.
class Myclass{
constructor(){
this.tax = this.taxMethod()
}
taxMethod(){
let data = 0;
this.simpleRequest(url,function(data){
data = Number(data[0].tx)
return data //Return of callback
}.bind(this))
return data //Empty data
}
}