sdk: fix retrieving progress information
This commit is contained in:
parent
16b6bda184
commit
f31b976c83
@ -152,13 +152,20 @@ var contented = (function ($, currentScriptPath) {
|
|||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
beforeSend: function (xhr) {
|
xhr: function() {
|
||||||
xhr.on('progress', function (ev) {
|
var xhr = $.ajaxSettings.xhr();
|
||||||
if (ev.lengthComputable) {
|
xhr.upload.addEventListener(
|
||||||
setProgressCaption("Uploaded " + formatBytes(evt.loaded) + " of " + formatBytes(evt.total) + "...");
|
'progress',
|
||||||
setProgressPercentage(evt.loaded / evt.total);
|
function(ev) {
|
||||||
}
|
console.log([ev.lengthComputable, ev.loaded, ev.total]);
|
||||||
});
|
if (ev.lengthComputable) {
|
||||||
|
setProgressCaption("Uploading (" + formatBytes(ev.loaded) + " / " + formatBytes(ev.total) + ")...");
|
||||||
|
setProgressPercentage(ev.total == 0 ? 0 : ev.loaded / ev.total);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
return xhr;
|
||||||
},
|
},
|
||||||
complete: function () {
|
complete: function () {
|
||||||
setProgressCaption("Upload complete.");
|
setProgressCaption("Upload complete.");
|
||||||
|
Loading…
Reference in New Issue
Block a user