Skip to content

Commit e692c12

Browse files
committed
Fix merge conflicts
2 parents d1f80c6 + 056dc0f commit e692c12

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/XMLHttpRequest.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,14 @@ exports.XMLHttpRequest = function() {
440440
this.readyState = this.UNSENT;
441441
};
442442

443+
var listeners = {};
444+
this.addEventListener = function(event, callback) {
445+
if (!(event in listeners)) {
446+
listeners[event] = [];
447+
}
448+
listeners[event].push(callback);
449+
};
450+
443451
/**
444452
* Changes readyState and calls onreadystatechange.
445453
*
@@ -450,5 +458,12 @@ exports.XMLHttpRequest = function() {
450458
if (typeof self.onreadystatechange === "function") {
451459
self.onreadystatechange();
452460
}
461+
462+
if ("readystatechange" in listeners) {
463+
var count = listeners["readystatechange"].length, i = 0;
464+
for(; i < count; i++) {
465+
listeners["readystatechange"][i].call(self);
466+
}
467+
}
453468
};
454469
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Dan DeFelippi"
77
, "url": "http://driverdan.com"
88
}
9-
, "keywords" ["xhr", "ajax"]
9+
, "keywords": ["xhr", "ajax"]
1010
, "licenses": [{
1111
"type": "MIT"
1212
, "url": "http://creativecommons.org/licenses/MIT/"

0 commit comments

Comments
 (0)