I have the following class. It has a bug since this reference at this.handlers (line 2) is different from this in this.setTimeRange (line 4)
function Synchronized() {
this.handlers = [];
$("#masterSlider").rangeSlider();
$("#masterSlider").bind("valuesChanging", function(e, data) {
this.setTimeRange(data.values.min, data.values.max);
});
}
Synchronized.prototype = {
setTimeRange: function(lowerBound, upperBound) {
console.log(lowerBound, upperBound);
this.lowerBound = lowerBound;
this.upperBound = upperBound;
$("#masterSlider").rangeSlider("bounds", this.lowerBound, this.upperBound);
},
}
How could I call class method from a callback function?