mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-21 02:40:07 +00:00
15 lines
407 B
TypeScript
15 lines
407 B
TypeScript
/* eslint-disable n/prefer-global/process */
|
|
|
|
export function shouldUseGlobalFetchAndWebSocket() {
|
|
// Browser env and deno when ran directly
|
|
if (typeof globalThis.process === 'undefined') {
|
|
return 'fetch' in globalThis && 'WebSocket' in globalThis;
|
|
}
|
|
|
|
if ('versions' in globalThis.process) {
|
|
return 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;
|
|
}
|
|
|
|
return false;
|
|
}
|