@sentry/lynx-react
Version:
Official Sentry SDK for Lynx React
40 lines (38 loc) • 1.36 kB
JavaScript
function isAndroid() {
var _a;
// SystemInfo.platform type suggest this always exists,
// but in browser lynx workers SystemInfo is empty object
return ((_a = globalThis.SystemInfo) === null || _a === void 0 ? void 0 : _a.platform) === 'Android';
}
function isIOS() {
var _a;
// SystemInfo.platform type suggest this always exists,
// but in browser lynx workers SystemInfo is empty object
return ((_a = globalThis.SystemInfo) === null || _a === void 0 ? void 0 : _a.platform) === 'iOS';
}
function isMobile() {
return isAndroid() || isIOS();
}
function notMobile() {
return !isMobile();
}
function isNodeLike() {
return (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]');
}
function isLynxBackgroundThread() {
return typeof __BACKGROUND__ !== 'undefined' && __BACKGROUND__;
}
function isBrowserMainThread() {
return typeof window !== 'undefined' && !isNodeLike() && notMobile();
}
function getLynx() {
if (typeof lynx === 'undefined') {
return undefined;
}
return lynx;
}
// TODO: Add isWebWorker
// TODO: Add isLynxWebBackgroundWorker
// TODO: Add isLynxWebMainThreadWorker
export { getLynx, isAndroid, isBrowserMainThread, isIOS, isLynxBackgroundThread, isMobile, isNodeLike, notMobile };
//# sourceMappingURL=environment.mjs.map