MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / progress

Function progress

src/lib/ajax.js:112–131  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

110 }
111
112 function progress(e) {
113 const { loaded, total } = e;
114 const percent = Math.round((loaded / total) * 100);
115 xhr.percent = percent;
116
117 if (typeof onprogress === "function") {
118 onprogress(loaded, total);
119 }
120
121 if (typeof ajax.onprogress === "function") {
122 const progresses = [];
123 xhrs = xhrs.filter((xhr) => {
124 if (xhr.status !== 200 || xhr.percent === 100) return false;
125 progresses.push(xhr.percent);
126 return true;
127 });
128
129 ajax.onprogress(Math.min(...progresses, 100));
130 }
131 }
132
133 function handleError() {
134 let res = xhr;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected