File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff line change 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/"
You can’t perform that action at this time.
0 commit comments