Say that I have a class with the some methods such as:
addClickListener(e) {
var self = this;
e.addEventListener('click', function() {
self.moveCharTo(e);
}, false);
}
removeClickListener(e) {
var self = this;
e.removeEventListener('click', function(){
self.moveCharTo(e);
}, false);
}
calling removeClickListener does not remove the event listener. Is it because self is being changed each time? Is there a way to assign self in the class constructor and then refer to it inside the anonymous function in the listener parameters?