MCPcopy Create free account
hub / github.com/flowjs/flow.js / FakeXMLHttpRequestUpload

Function FakeXMLHttpRequestUpload

test/FakeXMLHttpRequestUpload.js:13–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 */
12(function() {
13 function FakeXMLHttpRequestUpload() {
14 var xhr = this;
15 var events = ["loadstart", "progress", "abort", "error", "load", "loadend"];
16
17 function addEventListener(eventName) {
18 xhr.addEventListener(eventName, function (event) {
19 var listener = xhr["on" + eventName];
20
21 if (listener && typeof listener == "function") {
22 listener(event);
23 }
24 });
25 }
26
27 for (var i = events.length - 1; i >= 0; i--) {
28 addEventListener(events[i]);
29 }
30 }
31
32 sinon.extend(FakeXMLHttpRequestUpload.prototype, sinon.EventTarget);
33

Callers

nothing calls this directly

Calls 1

addEventListenerFunction · 0.85

Tested by

no test coverage detected