I am dealing with an API where It was a method on the Instance which returns a callback function
myPlayer.onPlay(function() {
console.log(this)
})
Now I would expect the context of this to be the player but it is not it is the callback function. I have tried binding the context of this like this but it doesn't work either.
I expected this to be myPlayer as that is the context in which the onPlay function was executed?
myPlayer.onPlay(function() {
console.log(this)
}).bind(this)
How would I get the context to be the instance of the player? Am i missing something?