mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Estimate progress when Content-Length header is missing
This commit is contained in:
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…
Reference in New Issue
Block a user