forked from mystiq/hydrogen-web
Merge pull request #571 from vector-im/fix-570
Make progress bar work for image uploads in Chrome
This commit is contained in:
commit
1fee773313
1 changed files with 5 additions and 4 deletions
|
@ -37,6 +37,11 @@ class RequestResult {
|
||||||
|
|
||||||
function createXhr(url, {method, headers, timeout, format, uploadProgress}) {
|
function createXhr(url, {method, headers, timeout, format, uploadProgress}) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
|
if (uploadProgress) {
|
||||||
|
xhr.upload.addEventListener("progress", evt => uploadProgress(evt.loaded));
|
||||||
|
}
|
||||||
|
|
||||||
xhr.open(method, url);
|
xhr.open(method, url);
|
||||||
|
|
||||||
if (format === "buffer") {
|
if (format === "buffer") {
|
||||||
|
@ -56,10 +61,6 @@ function createXhr(url, {method, headers, timeout, format, uploadProgress}) {
|
||||||
xhr.timeout = timeout;
|
xhr.timeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uploadProgress) {
|
|
||||||
xhr.upload.addEventListener("progress", evt => uploadProgress(evt.loaded));
|
|
||||||
}
|
|
||||||
|
|
||||||
return xhr;
|
return xhr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue