Estimate progress when Content-Length header is missing

pull/1445/head
tobspr 2 years ago
parent c74e4b9819
commit e870317a4f

@ -81,13 +81,10 @@
xhr.responseType = "arraybuffer";
xhr.onprogress = function (ev) {
if (ev.lengthComputable) {
console.log(ev.total);
progressHandler(ev.loaded / ev.total);
} else {
if (!notifiedNotComputable) {
notifiedNotComputable = true;
console.warn("Progress not computable:", ev);
progressHandler(0);
}
progressHandler(Math.min(1, ev.loaded / 1250000));
}
};

@ -197,7 +197,7 @@ export class BackgroundResourcesLoader {
} else {
if (!notifiedNotComputable) {
notifiedNotComputable = true;
console.warn("Progress not computable:", ev);
console.warn("Progress not computable:", src, ev);
progressHandler(0);
}
}

Loading…
Cancel
Save