Created
August 10, 2019 16:18
-
-
Save jojijacobk/73577fc814eb6030a1d909777a54db9b to your computer and use it in GitHub Desktop.
Intercept any XMLHttpRequests happening in your page either by your own code or from a third party library
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(originalOpen) { | |
XMLHttpRequest.prototype.open = function() { | |
this.addEventListener('progress', function() { | |
console.log('request in progress); | |
}); | |
this.addEventListener('load', function() { | |
console.log('request complete); | |
}); | |
originalOpen.apply(this, arguments); | |
}; | |
})(XMLHttpRequest.prototype.open); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment