Skip to content

How to get function name from getEventListener

I am trying to figure out a website basket and what is the name of the function that gets fired when clicked. I got my EventListener list by using getEventListener($0), and the following is the list but I cannot figure out how to find what event was fired on mousedown

enter image description here

Answer

As in fact on the @mamady answer, you can get the name of the function that get fired on mouseDown using getEventListener($0).mousedown[0].listener.name with Chrome dev tools.

As you see, probably the function name does not appears beacause it does not have a named function, so the function is annonymous, but you can see the location of the function:

enter image description here

If it’s not, you can see the name of the function:

enter image description here

If the main problem is another (you have to get the name of the function to do something, what something?), please comment here.