Execute code in background (threads)

is there any plugin or way to execute proccesses in background, (i mean in other threads)??

1 Like

In theory, you could use web workers depending on what versions of iOS and Android you want to support.


You may also consider just using asynchronous code with promises. Angular has the $q injectable for this.

Here’s a post to understand promises.

thanks @andrewmcgivery
i have used promises in other tasks, but im having problems with a plugin that is sync my server sql with my local sqlite db,
and its blocking the user interface.

have any use webworkers with ionic,?
any other idea to execute code and dont blocked the user interface??

Give us some more information.

  • What plugin are you using that may be blocking the UI?
  • What do you mean by “in sync with my server sql and local db”? - In sync how?
  • Post some code to show how you are accessing the database.

~ Brad

1 Like

hi @ArcReaction , thanks for reading.

im using zumero, www.zumero.com in devcenter tab you can download a seed project. this sync my sqlite db with my sql server backend, to sync changes when network its available,.
when zumero is performing a sync the ui is getting blocked.
and to manage my sqlite im using brodysoft sqlite plugin, .

let me put in context,
when no network its available all the data im registering on my app is saved to sqlite, and the app run smoothly,

but when a network is available im saving data to my sqlite and inmediatly im trying to sync with my sql server (zumero server) and then is when im getting blocked until dthe sync is completed.
is there anyway yo get the user move smoothly on the app while the sync is running in backgroud , or an other thread.

many thanks in advanced for helping me

1 Like

I am facing the same problem do you get any answer for that ??