MCPcopy Create free account
hub / github.com/Yaffle/EventSource / onStart

Function onStart

tests/eventsource.js:249–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247 };
248
249 var onStart = function () {
250 if (state === 1) {
251 //state = 2;
252 var status = 0;
253 var statusText = "";
254 var contentType = undefined;
255 if (!("contentType" in xhr)) {
256 try {
257 status = xhr.status;
258 statusText = xhr.statusText;
259 contentType = xhr.getResponseHeader("Content-Type");
260 } catch (error) {
261 // IE < 10 throws exception for `xhr.status` when xhr.readyState === 2 || xhr.readyState === 3
262 // Opera < 11 throws exception for `xhr.status` when xhr.readyState === 2
263 // https://bugs.webkit.org/show_bug.cgi?id=29121
264 status = 0;
265 statusText = "";
266 contentType = undefined;
267 // Firefox < 14, Chrome ?, Safari ?
268 // https://bugs.webkit.org/show_bug.cgi?id=29658
269 // https://bugs.webkit.org/show_bug.cgi?id=77854
270 }
271 } else {
272 status = 200;
273 statusText = "OK";
274 contentType = xhr.contentType;
275 }
276 if (status !== 0) {
277 state = 2;
278 that.readyState = 2;
279 that.status = status;
280 that.statusText = statusText;
281 that._contentType = contentType;
282 that.onreadystatechange();
283 }
284 }
285 };
286 var onProgress = function () {
287 onStart();
288 if (state === 2 || state === 3) {

Callers 2

onProgressFunction · 0.70
onReadyStateChangeFunction · 0.70

Calls 2

fireFunction · 0.70
closeFunction · 0.70

Tested by

no test coverage detected