I have an Angular application which initialises Web Worker and starts some rendering operations inside it. Worker has instance of helper class Renderer to perform rendering operations.
Now I need to get real time data from RealtimeDataService (@Injectable) to feed to the Renderer.
But when I'm importing the service inside my helper class Renderer (or directly to the worker typescript file), compiler is throwing me this error:
ERROR in ./src/app/workers/ecg.worker.ts (./node_modules/worker-plugin/dist/loader.js!./src/app/workers/ecg.worker.ts) Module build failed (from ./node_modules/worker-plugin/dist/loader.js): Error: ../../../node_modules/@angular/core/core.d.ts(1470,29): error TS2304: Cannot find name 'Element'. ../../../node_modules/@angular/core/core.d.ts(9115,81): error TS2304: Cannot find name 'HTMLElement'. ../../../node_modules/@angular/core/core.d.ts(10194,62): error TS2304: Cannot find name 'Node'. ../../../node_modules/@angular/core/core.d.ts(13467,20): error TS2304: Cannot find name 'Document'. ../../../node_modules/@angular/core/core.d.ts(13481,13): error TS2304: Cannot find name 'Window'.
How can I use injectable service inside Web Worker context?