Improved uploader
This commit is contained in:
parent
d9ff1513b8
commit
0f28cdbc3d
@ -10,8 +10,12 @@ export function fetchWithProgress(url, options: RequestInit, onProgress: ((this:
|
|||||||
xhr.onload = e => resolve(xhr.responseText)
|
xhr.onload = e => resolve(xhr.responseText)
|
||||||
xhr.onerror = reject
|
xhr.onerror = reject
|
||||||
|
|
||||||
if(xhr.upload && onProgress) {
|
if(onProgress) {
|
||||||
xhr.upload.onprogress = onProgress
|
xhr.addEventListener("progress", onProgress)
|
||||||
|
|
||||||
|
if(xhr.upload) {
|
||||||
|
xhr.upload.onprogress = onProgress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xhr.send(options.body)
|
xhr.send(options.body)
|
||||||
|
Loading…
Reference in New Issue
Block a user