UNPKG

@splitsoftware/splitio-react-native

Version:
23 lines (20 loc) 947 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEventSource = getEventSource; var _reactNative = _interopRequireDefault(require("react-native")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } let _RNEventSource; // Try-catch to avoid Jest error `Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules` try { if (_reactNative.default.NativeModules && _reactNative.default.NativeModules.RNEventSource) _RNEventSource = require('./EventSource/EventSource'); } catch (e) {} /** * Returns native implementation of EventSource. If not available (e.g., Expo or other runtime than Android and iOS), * checks if global EventSource is available and returns it. */ function getEventSource() { return _RNEventSource || (typeof EventSource === 'function' ? EventSource : undefined); } //# sourceMappingURL=getEventSource.js.map