function LolClass(){
this.init = function(){
button_a.bind("tap", function(){
this.refreshFields(); // doesn't work
//refreshFields(); // doesn't work either
});
}
this.refreshFields = function(){
alert("LOL");
}
this.dummy = function(){
this.refreshFields(); // W O R K S!
}
}
When I tap the button_a, I get a reference error, as refreshFields method isn't "found".
Uncaught ReferenceError: refreshFields is not defined at file:///android_asset/www/src/pages/main.js:70
But if I call that method in other places than that tap listener, it works.
I'm totally certain that the this
inside the tap listener function is referencing to button_a, the event target.
My question is: What is the best(oo) fix for that?