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

148
Visualizações
vocabulary and life cycle of events in javascript/vuejs

I'm newcomer to programming world and I'm confused with some terms when it comes to talk about events

so I want an explanation about what is meant with

  • trigger an event
  • emit an event
  • dispatch an event

and what is the order of their use

Moreover I came across this code

code in js file

  document.addEventListener('event-test', (event) => {
    const eventTest = event;
    if (eventTest) {
      const test1 = eventTest.id;
      if (eventTest.type === 'name') { 
        document.dispatchEvent(new CustomEvent('name-set', {detail: {
          id: eventTest.id,          
        }}));
      }
    }
  });

code in vue file

  created() {
    this.$root.$on('name-set', this.obj);
    this.init();
  },

could you explain how does it work and what should it do ?

about 4 years ago · Juan Pablo Isaza
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