mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
9 lines
266 B
TypeScript
9 lines
266 B
TypeScript
/**
|
|
* Detect if this thread is running in a Worker context.
|
|
*
|
|
* https://stackoverflow.com/a/18002694
|
|
*/
|
|
export function isWorker(): boolean {
|
|
// @ts-ignore This is fine.
|
|
return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
|
|
}
|