I'm making a chrome plugin which will intercept an AJAX response and modify it before it is displayed.
I found this piece of code:
(function(open) {
XMLHttpRequest.prototype.open = function() {
alert('Intercept');
open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.open);
from this question: Intercept Ajax request?
I'm not sure how to make use of it. For example I read another question talking about using an addEventListener, I'm not sure what that would look like. I'm quite lost on this and would appreciate any guidance.