Created
November 8, 2016 14:15
-
-
Save pingyen/a21417bbb26c72756d78f1f49af7f754 to your computer and use it in GitHub Desktop.
Spy of XMLHttpRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var prototype = XMLHttpRequest.prototype, | |
open = prototype.open, | |
send = prototype.send; | |
prototype.open = function() { | |
alert('open: ' + JSON.stringify(arguments)); | |
open.apply(this, arguments); | |
}; | |
prototype.send = function() { | |
alert('send: ' + JSON.stringify(arguments)); | |
this.addEventListener('load', function() { | |
alert('load: ' + JSON.stringify(arguments)); | |
}); | |
send.apply(this, arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment