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

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