Open prasadyallapu opened 8 years ago
Hi prasadyallapu
You can use https://github.com/blittle/bridged-worker script to build a web worker and create script which will be ran in separate thread. This example is pure javascript so you'll have to adjust it for Angular apps.
In practice, create new Angular module and define worker bridge as a service: https://gist.github.com/anteburazer/ac0ef270fc91c28b5e506c16d3db1c06
This service will be used to construct you web worker functions.
Next, create your worker script which will perform some action: https://gist.github.com/anteburazer/b5ff29cb321d6684bdbca4e0f50cf06f
This example shows how to insert some data into local database using Cordova sqlite plugin. As you can see you can inject other services as well (e.g. DataStoreService is a service which returns some data which you can iterate over and build an SQL query)
In order to run a worker you have to inject InsertDataWorke service in your file and call start function. Worker will broadcast data-inserted event which will indicate that operation is finished.
I hope this helps
Hy netmedia,
This may be unrelevant issue I am rasing.I am currently working on ionic.I was trying to do some background service.Did u figured it out.How to do in ionic.If you share details that will be helpful for me.
Thanks.