这个问题最好用一些代码来解释,所以这里是:
// a class
function a_class {
this.a_var = null;
this.a_function = a_class_a_function;
}
// a_class::a_function
function a_class_a_function() {
AFunctionThatTakesACallback(function() {
// How to access this.a_var?
});
}
// An instance
var instance = new a_class();
instance.a_function();
从回调中AFunctionThatTakesACallback()
,如何访问this.a_var
?