Luke
Luke

Reputation: 133

AJAX events logging in Google Chrome extension

I'm working on google chrome extension which logs multiple events. I have a problem with AJAX events. I found this code to log every single AJAX event:

 document.addEventListener("DOMSubtreeModified", function(event){
            console.log("AJAX event");
    });

But it logs hundreds of them. Does anybody know how to distinguish which page element fired which event? And what caused the event (click, mouse move)?

Upvotes: 0

Views: 755

Answers (1)

Clive
Clive

Reputation: 36955

You can get the event type by simply calling event.type in your callback function. You should get click/mousemove/mouseover etc. Try console.log(event) and see what else you can find too!

Upvotes: 2

Related Questions