How to load tracker in back-ground worker JS

I am trying to add snowplow code in background-worker javascript but as we don’t have window and document available in background-workers, snowplow is not initializing correctly and I am not able to track the events.
Can you please help me how to achieve this?