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

195
Vistas
Typescript React how to store an Object permanently

Good day,

I am coding a compass application in react and have some problems.

I am working with a DeviceOrientationEvent, if i add an EventListener it orientates to the device heading, not to the absolute earth heading.

My idea is, to display a calibration button, the user has to orientate his phone to north (deviceheading === absolute earth heading) and then press the button.

Here a code example:

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.
}

If the button get pressed, i set the orientation event listener and get a DeviceOrientationEvent which points to north.

My problem: If i restart the application i have to calibrate the app new.

My idea: Calibrate it once and than store the "DeviceOrientationEvent" instance permanently. After restarting i can load and use it.

Have you some idea how i can store an object instance?

I´ll publish the application as android app

Thanks for help!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

One option is to make use of local storage to store the data.

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