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

743
Visualizações
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 Respostas
Responde à pergunta

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 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