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

192
Views
Typescript React cómo almacenar un objeto de forma permanente

Buenos días,

Estoy codificando una aplicación de brújula en reaccionar y tengo algunos problemas.

Estoy trabajando con un DeviceOrientationEvent, si agrego un EventListener se orienta al encabezado del dispositivo, no al encabezado absoluto de la tierra.

Mi idea es que, para mostrar un botón de calibración, el usuario tiene que orientar su teléfono hacia el norte (dirección del dispositivo === dirección absoluta de la tierra) y luego presionar el botón.

Aquí un ejemplo de código:

 calibrationButtonOnClick() //Method which is executed when pressing the calibration button { orientationHandler = await Motion.addListener("orientation", (event:any) => {orientationChange(event)}); //The orientationHandler object i want to store permanent. }

Si se presiona el botón, configuro el detector de eventos de orientación y obtengo un DeviceOrientationEvent que apunta hacia el norte.

Mi problema: si reinicio la aplicación, tengo que calibrar la aplicación como nueva.

Mi idea: Calibre una vez y luego almacene la instancia de "DeviceOrientationEvent" de forma permanente. Después de reiniciar, puedo cargarlo y usarlo.

¿Tiene alguna idea de cómo puedo almacenar una instancia de objeto?

Publicaré la aplicación como aplicación de Android.

¡Gracias por la ayuda!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Una opción es hacer uso del almacenamiento local para almacenar los datos.

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