Fix existing "this" scope issue in progress handler

This commit is contained in:
Joe Vu 2014-10-16 16:01:33 -07:00
parent dfef13aa7b
commit a1c53669d1

View File

@ -1,4 +1,4 @@
// Backbone.Model File Upload v0.5
// Backbone.Model File Upload v0.5.1
// by Joe Vu - joe.vu@homeslicesolutions.com
// For all details and documentation:
// https://github.com/homeslicesolutions/backbone-model-file-upload
@ -88,9 +88,10 @@
options.contentType = false;
// Apply custom XHR for processing status & listen to "progress"
var that = this;
options.xhr = function() {
var xhr = $.ajaxSettings.xhr();
xhr.upload.addEventListener('progress', this._progressHandler.bind(this), false);
xhr.upload.addEventListener('progress', that._progressHandler.bind(that), false);
return xhr;
}
}