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.responseType = "arraybuffer";
|
||||||
xhr.onprogress = function (ev) {
|
xhr.onprogress = function (ev) {
|
||||||
if (ev.lengthComputable) {
|
if (ev.lengthComputable) {
|
||||||
|
console.log(ev.total);
|
||||||
progressHandler(ev.loaded / ev.total);
|
progressHandler(ev.loaded / ev.total);
|
||||||
} else {
|
} else {
|
||||||
if (!notifiedNotComputable) {
|
progressHandler(Math.min(1, ev.loaded / 1250000));
|
||||||
notifiedNotComputable = true;
|
|
||||||
console.warn("Progress not computable:", ev);
|
|
||||||
progressHandler(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ export class BackgroundResourcesLoader {
|
|||||||
} else {
|
} else {
|
||||||
if (!notifiedNotComputable) {
|
if (!notifiedNotComputable) {
|
||||||
notifiedNotComputable = true;
|
notifiedNotComputable = true;
|
||||||
console.warn("Progress not computable:", ev);
|
console.warn("Progress not computable:", src, ev);
|
||||||
progressHandler(0);
|
progressHandler(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user