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

196
Views
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 answers
Answer question

0

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

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!