In the case I have a code structure as follows :
Thing.prototype = {
doSomething: function() {
$(selector).click(this.handleClick.bind(null, this));
},
handleClick: function(self, event) {
console.log(this); //Window
console.log(self); //Thing
}
}
How could one bind the Thing this
context to the self
argument and still keep the behavior of the this
object as if no arguments were bound using the bind
method?
Note : I know I can bind this
and use e.originalEvent.target
to get the behaviour I want but I'm just curious if there is another way
I hope I'm getting through with what I want to achieve, leave a comment if something is ambiguous.