Skip to content

Instantly share code, notes, and snippets.

@honsa
Last active May 18, 2018 20:15
Show Gist options
  • Save honsa/5d6840958d8b981cbb87ede2e5e737f4 to your computer and use it in GitHub Desktop.
Save honsa/5d6840958d8b981cbb87ede2e5e737f4 to your computer and use it in GitHub Desktop.
xhr interception
(function (open) {
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) {
this.addEventListener("readystatechange", function () {
let state = this.readyState;
console.log(this);
if (this.readyState === 4) {
//here you go
}
}, false);
open.call(this, method, url, async, user, pass);
};
})(XMLHttpRequest.prototype.open);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment