UNPKG

react-native-ble-nitro

Version:

High-performance React Native BLE library built on Nitro Modules - drop-in replacement for react-native-ble-plx

23 lines (22 loc) 974 B
import { NitroModules } from 'react-native-nitro-modules'; /** * Creates a BleManager instance using Nitro Modules * This function maintains compatibility with react-native-ble-plx's BleManager constructor */ export function createBleManager(options) { const BleManagerModule = NitroModules.createHybridObject('BleManager'); if (!BleManagerModule) { throw new Error('Failed to create BleManager: Nitro module not found. ' + 'Make sure react-native-ble-nitro is properly installed and linked.'); } // If options are provided, we could initialize with them // For now, we return the module directly as Nitro handles the native initialization return BleManagerModule; } /** * Legacy compatibility: Export a BleManager constructor function * This maintains compatibility with code that imports { BleManager } from 'react-native-ble-plx' */ export const BleManager = function (options) { return createBleManager(options); };