i have my functions defined in an object like this:
_clickHandler: function(event){
event.preventDefault();
},
attachClickEv: function(element){
......
element.on('click', this._clickHandler);
},
the problem is that I cannot seem to pass "this" to the clickHandler function
I know that I could wrap that in another function like
var tthis = this;
element.on('click', function(event){
tthis._clickHandler(event, tthis);
});
but then I cannot unhook the function later with
element.off('click', this._clickHandler);
is there any other way to do it?
Aucun commentaire:
Enregistrer un commentaire