I am trying to bind
(ie bind(this)
) the inline anonymous callback function to the object
How can it be done?
Simplified example:
var object = {
property: function() {
this.id = 'abc'; // 'this' binds to the object
aFunctionWithCallback(this.id, function(data) {
console.log(this); // null
});
}
};
functionName.bind(this)(arg)
but I hadn't tried it in such a case & didn't find the info, hence the question :)