我有一个使用 XHR 上传文件的 mootools 类:
var foo = new Class({
initialize: function() {
this.bar = 'value';
},
upload: function() {
// This method uploads a file
….
xhr.addEventListener('load', this.uploadComplete, false);
….
},
uploadComplete: function() {
// Is getting called on completion of file upload
console.log(this.bar); // undefined, but I want to to be 'value'
}
});
我想访问this.bar
该uploadComplete
方法,但this
没有通过xhr.addEventListener('load', this.uploadComplete, false);
任何帮助表示赞赏。