The best option here (IMO) is to simply save another link, I prefer self, for example:
function MyClass(){
var self = this;
this.message = 'Hello World';
$('div').draggable({drag:this.onDrag});
this.onDrag = function(event,ui){
alert(self.message);
}
}
The alternative conflicts with the context of another plugin that you really don't control when (again, IMO) you really don't need it, just having another link to access your class is just as easy and less confusing in many cases.
source
share