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

Function onFinish

tests/eventsource.js:301–328  ·  view source on GitHub ↗
(type, event)

Source from the content-addressed store, hash-verified

299 }
300 };
301 var onFinish = function (type, event) {
302 if (event == null || event.preventDefault == null) {
303 event = {
304 preventDefault: k
305 };
306 }
307 // Firefox 52 fires "readystatechange" (xhr.readyState === 4) without final "readystatechange" (xhr.readyState === 3)
308 // IE 8 fires "onload" without "onprogress"
309 onProgress();
310 if (state === 1 || state === 2 || state === 3) {
311 state = 4;
312 if (timeout !== 0) {
313 clearTimeout(timeout);
314 timeout = 0;
315 }
316 that.readyState = 4;
317 if (type === "load") {
318 that.onload(event);
319 } else if (type === "error") {
320 that.onerror(event);
321 } else if (type === "abort") {
322 that.onabort(event);
323 } else {
324 throw new TypeError();
325 }
326 that.onreadystatechange();
327 }
328 };
329 var onReadyStateChange = function (event) {
330 if (xhr != undefined) { // Opera 12
331 if (xhr.readyState === 4) {

Callers 3

onReadyStateChangeFunction · 0.70
eventsource.jsFile · 0.70
onTimeoutFunction · 0.70

Calls 4

onProgressFunction · 0.70
onTimeoutFunction · 0.70
clampDurationFunction · 0.70
fireFunction · 0.70

Tested by

no test coverage detected