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

173
Views
No se pueden recuperar datos de un objeto a otro objeto Javascript

Estoy tratando de recuperar los datos de un proceso. Un módulo lo hace automáticamente. Sin embargo, estoy intentando exportar los datos, así que intenté agregarlos a otro objeto y luego exportar el objeto, pero envía un objeto vacío.

(Esto es lo que estoy tratando de recuperar si necesita más contexto: https://hextechdocs.dev/getting-started-with-the-lcu-api )

Aquí está el código:

 import LCUConnector from 'lcu-connector' const connector = new LCUConnector(); const dataRetrieved = {username: ''} connector.on('connect', (data) => { console.log(data) //Shows the data dataRetrieved.username = data.username; //Gives the username to dataRetrieved console.log(dataRetrieved) //Can see the username in DataRetrieved connector.stop() //Closes the connector }); connector.start() //Calls the .on event console.log(dataRetrieved) //dataRetrieved is empty + get asked before the event handler export default dataRetrieved; //When I import in another module, it is empty

Aquí está el código para el detector de eventos y el LCUConnector:

 declare class LCUConnector { constructor(path?: string); static getLCUPathFromProcess(): Promise<string | void>; static isValidLCUPath(dirPath: string): boolean; start(): void; stop(): void; on(event: 'connect', listener: (data: { address: string, port: number, username: string, password: string, protocol: string }) => string): this; on(event: 'disconnect', listener: () => void): this; } export = LCUConnector;

Me falta algo importante, pero no sé por qué no almacena los datos en mi objeto dataRetrieved.

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!