爲什麼第一種情況不起作用?它只是以單例格式引用完全相同的功能。用於XHR上傳功能的單例參考不起作用
案例1 ..
var n = {
doThis: function(e){
console.log('hello world');
}
};
xhr.upload.onprogress = n.doThis(e);
案例2 ..
xhr.upload.onprogress = function(e){
console.log('hello world');
}
謝謝,我以爲我必須傳遞事件(e) –