Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

748
Vistas
Is there any method to replace initEvent in typescript?

I would like to trigger the MouseEvent manually in typescript and it shows the initEvent is deprecated.

var clickEvent =document.createEvent('MouseEvent');
clickEvent.initEvent('mouseup',true,true);

in this screenshot, it shows the initEvent is deprecated.

Is there any alternate way to achieve this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

initEvent is now depreciated as shown in the hint. A note in the docs says:

Note: Do not use this method anymore as it is deprecated. Instead use specific event constructors, like Event().

MouseEvent is an interface and it is used by different types of events. One of them being mouseup. The new way of doing this is :

const mouseupEvent = new MouseEvent("mouseup",{bubbles : true, cancelable: true});

// Dispatch the event.
document.dispatchEvent(clickEvent);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda