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

147
Views
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
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!