A WebWorker executes with a scope completely separate from the \'window\' context of traditional JavaScript. Is there a standard way for a script to determine if it is, its
This worked for me
if (self.document) { console.log('We are calculating Primes in Main Thread'); } else { console.log('We are calculating Primes in Worker Thread'); }