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
// Taken from https://stackoverflow.com/a/27363569 | |
// Allows for the object to be interrogated | |
((() => { | |
const origOpen = XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function() { | |
console.log('request started!'); | |
this.addEventListener('load', function() { | |
console.log('request completed!'); | |
console.log(this.readyState); //will always be 4 (ajax is completed successfully) |