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

215
Views
Why Vue3 is clearing event:Event in a setTimeout while compiling into a Web Custom Element

I have a Vue3.2 (3.2.33) component which is perfectly working while deployed as a SPA. I tried to wrap it as a web Custom Element with a very sample wrapping:

import { defineCustomElement } from 'vue';
import TrackJoiner from '@/views/TrackJoinerView.vue'

const TrackJoinerElement = defineCustomElement({...TrackJoiner})

customElements.define('trackjoiner-element', TrackJoinerElement)

The custom element is perfectly inserted in my html page with

<trackjoiner-element/>

The problem comes with a call to my API in a setTimeout. In fact the event becomes null in the setTimeout callback, this is the Vue3 method:

  methods: {
    clickFile(event: Event, trackType: trackTypes) {
      (this.state as ReactiveData).isLoading = true;
      setTimeout(() => {
        openFileAsPromise(event, trackType).then(() => {
          this.updateRows();
        });
      });
    },

While debugging I saw that event is correct before calling setTimeout(), but becomes null while calling openFileAsPromise(event, trackType) but trackType remains correct.

While running as a Vue3 SPA this code works perfectly and the event is forwarded to openFileAsPromise()

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!