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.onerror = reject
|
||||
|
||||
if(xhr.upload && onProgress) {
|
||||
xhr.upload.onprogress = onProgress
|
||||
if(onProgress) {
|
||||
xhr.addEventListener("progress", onProgress)
|
||||
|
||||
if(xhr.upload) {
|
||||
xhr.upload.onprogress = onProgress
|
||||
}
|
||||
}
|
||||
|
||||
xhr.send(options.body)
|
||||
|
Loading…
Reference in New Issue
Block a user