if(typeof Window !== 'undefined'){
// browser
}else if(typeof WorkerGlobalScope !== 'undefined'){
// browser worker
}else if(typeof module !== 'undefined'){
// node.js
const {isMainThread} = require('worker_threads');
if(isMainThread){
// MainThread
}else{
// worker
}
}