@sentry/lynx-react
Version:
Official Sentry SDK for Lynx React
1 lines • 2.41 kB
Source Map (JSON)
{"version":3,"file":"environment.mjs","sources":["../../src/environment.ts"],"sourcesContent":["import { UnsafeLynx } from '@lynx-js/types';\n\nexport function isLynx(): boolean {\n return !!globalThis.lynx;\n}\n\nexport function isAndroid(): boolean {\n // SystemInfo.platform type suggest this always exists,\n // but in browser lynx workers SystemInfo is empty object\n return globalThis.SystemInfo?.platform === 'Android';\n}\n\nexport function isIOS(): boolean {\n // SystemInfo.platform type suggest this always exists,\n // but in browser lynx workers SystemInfo is empty object\n return globalThis.SystemInfo?.platform === 'iOS';\n}\n\nexport function isMobile(): boolean {\n return isAndroid() || isIOS();\n}\n\nexport function notMobile(): boolean {\n return !isMobile();\n}\n\nexport function isNodeLike(): boolean {\n return (\n Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'\n );\n}\n\nexport function isLynxBackgroundThread(): boolean {\n return typeof __BACKGROUND__ !== 'undefined' && __BACKGROUND__;\n}\n\ndeclare const window: unknown;\n\nexport function isBrowserMainThread(): boolean {\n return typeof window !== 'undefined' && !isNodeLike() && notMobile();\n}\n\nexport function getLynx(): undefined | UnsafeLynx & {\n getApp?: () => {\n _params?: {\n srcName?: string;\n };\n } | undefined;\n} {\n if (typeof lynx === 'undefined') {\n return undefined;\n }\n return lynx;\n}\n\n// TODO: Add isWebWorker\n// TODO: Add isLynxWebBackgroundWorker\n// TODO: Add isLynxWebMainThreadWorker\n"],"names":[],"mappings":"SAMgB,SAAS,GAAA;;;;IAGvB,OAAO,CAAA,MAAA,UAAU,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,QAAQ,MAAK,SAAS;AACtD;SAEgB,KAAK,GAAA;;;;IAGnB,OAAO,CAAA,MAAA,UAAU,CAAC,UAAU,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,QAAQ,MAAK,KAAK;AAClD;SAEgB,QAAQ,GAAA;AACtB,IAAA,OAAO,SAAS,EAAE,IAAI,KAAK,EAAE;AAC/B;SAEgB,SAAS,GAAA;IACvB,OAAO,CAAC,QAAQ,EAAE;AACpB;SAEgB,UAAU,GAAA;IACxB,QACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC,CAAC,KAAK,kBAAkB;AAEvG;SAEgB,sBAAsB,GAAA;AACpC,IAAA,OAAO,OAAO,cAAc,KAAK,WAAW,IAAI,cAAc;AAChE;SAIgB,mBAAmB,GAAA;IACjC,OAAQ,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,UAAU,EAAE,IAAI,SAAS,EAAE;AACvE;SAEgB,OAAO,GAAA;AAOrB,IAAA,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;AAC/B,QAAA,OAAO,SAAS;AACjB;AACD,IAAA,OAAO,IAAI;AACb;AAEA;AACA;AACA;;;;"}