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

Function onreadystatechange

src/lib/ajax.js:92–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90 xhr.send(body);
91
92 function onreadystatechange() {
93 const { readyState, status } = xhr;
94
95 if (readyState === 2) {
96 if (status >= 200 && status < 300) {
97 xhr.responseType = responseType;
98 } else {
99 xhr.responseType = "text";
100 }
101 } else if (readyState === 4) {
102 if (status >= 200 && status < 300) {
103 const res = ajax.response(xhr);
104 onsuccess(res);
105 resolve(res);
106 } else {
107 handleError();
108 }
109 }
110 }
111
112 function progress(e) {
113 const { loaded, total } = e;

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.85
handleErrorFunction · 0.70

Tested by

no test coverage detected