Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
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

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

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.

about 4 years ago · Juan Pablo Isaza Relatório

0

Your description is quite different from the title. Do you want the function name that is bound to an event? Or do you want the event itself?

If you want the function name try this in your browser console:

  function asdasd(e) {
    console.log(e)
  }

  let button = document.createElement('button');
  button.addEventListener('mousedown', asdasd);
  let listeners = getEventListeners(button);
  console.log(listeners.mousedown[0].listener.name, "<- NAME OF THE FUNCTION");

enter image description here

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda