mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-04-22 02:42:08 +00:00
21 lines
547 B
TypeScript
21 lines
547 B
TypeScript
import type { Endpoints } from './interfaces'
|
|
|
|
/**
|
|
* detect the current running context ofthe program
|
|
*/
|
|
export function detectContext(): 'browser' | 'server' {
|
|
try {
|
|
const isBrowser = !!window
|
|
return isBrowser ? 'browser' : 'server'
|
|
} catch {
|
|
return 'server'
|
|
}
|
|
}
|
|
|
|
export const ENDPOINTS: ReadonlyArray<Endpoints> = [
|
|
'cards', 'categories', 'dex-ids', 'energy-types',
|
|
'hp', 'illustrators', 'rarities', 'regulation-marks',
|
|
'retreats', 'series', 'sets', 'stages', 'suffixes',
|
|
'trainer-types', 'types', 'variants', 'random'
|
|
] as const
|