UNPKG

@baqhub/sdk-react-native

Version:

The official React Native SDK for the BAQ federated app platform.

30 lines (29 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); // We don't actually want to polyfill "fetch". // It was more complicated to manually polyfill one by one. const originalFetch = global.fetch; const originalHeaders = global.Headers; const originalRequest = global.Request; const originalResponse = global.Response; // Polyfill for URL, btoa/atob, ReadableStream, // fetch, TextEncoder/TextDecoder, crypto.getRandomValues() require("react-native-polyfill-globals/auto"); const polyFetch = global.fetch; global.fetch = originalFetch; global.Headers = originalHeaders; global.Request = originalRequest; global.Response = originalResponse; const eventSourceFetch = (input, init) => { return polyFetch(input, { ...init, reactNative: { textStreaming: true }, }); }; const sdk_1 = require("@baqhub/sdk"); (0, sdk_1.setHttpApi)({ fetch: originalFetch, eventSourceFetch: eventSourceFetch, }); tslib_1.__exportStar(require("./asyncStorageAdapter.js"), exports);