Create http request with WebWorker



I’m trying to use nativescript web worker and i’m having a problem .
i want to make the http request in the webWorker.ts using http angular service
i need to import the http angular servie to the worker.ts and use it there

I’ve tried to send the http service as a parameter to the worker.ts but its do not works because its Initializing the service

I was hoping that the code will look something like that

(<any>global).onmessage = (msg: any) => {
       (make the httpRequest..... ).subscribe(response=>{

did you have any idea how can i do it ?


An http itself runs on separate thread so you don’t have to create a web worker for that. Only use web worker if you intended to do any long running operations.