How to start second thread in ionic


#1

how we can start second process in ionic because i want to start some calculation in background without effecting user interface tread


#2

Something like…

   doSomething(){
      return new Promise((resolve, reject) {
         //pretend a long-running task
         setTimeout(() => { resolve(true); }, 5000);
      });
   }

Then call from your code

    this.doSomething().then(truthy => { console.log('finished'); });

#3

please follow attached link , i want implement same https://forum.ionicframework.com/t/unable-to-provide-geolocation-when-app-in-background-mode/136272


#4

I used this plugin in the past…

It does have a cost - but works!


#5

This looks promising


#6

I think when you say background you mean when the app is closed or hidden…

Refer to my previous two posts.


#7

NO I want to run two separate thread


#8

The thing you are looking for is web worker which runs on separate thread in background without affecting the main thread ui.