Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
Eliminar un detector de eventos para la función de flecha con parámetros

En JavaScript, ¿cómo puedo eliminar un detector de eventos que se agregó mediante una función de flecha con parámetros?

 class myClass { animateIn(callback) { // Add an event listener for the end of the animation this.myDomElement.addEventListener( 'animationend', (e) => this.onAnimateInAnimationEnd(e, callback) ); } onAnimateInAnimationEnd = (e, callback) => { // Remove the event listener for the end of the animation this.myDomElement.removeEventListener( 'animationend', (e) => this.onAnimateInAnimationEnd(e, callback) ); } }

Entiendo que usar this.onAnimateInAnimationEnd en lugar de (e) => this.onAnimateInAnimationEnd(e, callback) eliminará el detector de eventos correctamente. Sin embargo, eso no me permite acceder al parámetro de callback de llamada dentro onAnimateInAnimationEnd .

¿Cómo hago para que funcione tanto con e , que está relacionado con el evento que estoy escuchando, como con callback , que no está relacionado con ese evento?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!