@sentry/lynx-react
Version:
Official Sentry SDK for Lynx React
20 lines (17 loc) • 778 B
JavaScript
import { isMobile, getLynx, isBrowserMainThread } from '../environment.mjs';
function getFetch() {
var _a;
if (isMobile()) {
return (_a = getLynx()) === null || _a === void 0 ? void 0 : _a.fetch;
}
if (isBrowserMainThread()) {
return undefined; // Will be resolved internally
}
// Most likely a web worker
// TODO: Verify if actually a web worker else return getNativeImplementation default fetch
// Internal fetch resolution doesn't work for web workers and globalThis.fetch is also undefined
// https://github.com/getsentry/sentry-javascript/blob/de2c1ad309b850c1254c69890c96e869e297fa4c/packages/browser-utils/src/getNativeImplementation.ts#L27
return fetch;
}
export { getFetch };
//# sourceMappingURL=fetch.mjs.map