UNPKG

@react-native-ohos/react-native-mmkv-storage

Version:

This library aims to provide a fast & reliable solution for you data storage needs in react-native apps. It uses [MMKV](https://github.com/Tencent/MMKV) by Tencent under the hood on Android and iOS both that is used by their WeChat app(more than 1 Billion

37 lines (35 loc) 1.36 kB
"use strict"; var rn = require("react-native"); var {TurboModuleRegistry } = rn; Object.defineProperty(exports, "__esModule", { value: true }); exports.mmkvBridgeModule = void 0; //@ts-ignore const isDebugMode = global.location && global.location.pathname && global.location.pathname.includes('/debugger-ui'); const isTurboModuleEnabled = global.__turboModuleProxy != null; exports.mmkvBridgeModule = !isDebugMode ? isTurboModuleEnabled ? require('./NativeMMKVStorage').default : require('react-native').NativeModules.MMKVStorage : { install: () => { console.warn(`Remote debugging is not supported by JSI modules. MMKV is running with a memory adapter currently and is fully functional for testing only. Hence any values will not persist on App refresh/reload. `); require('../../../jest/dist/jest/memoryStore.js').mock(); return true; } }; /** * All jsi functions bound to global object. * * The last param `id` is the instance id of the storage instance we want to get/set the value. * * `undefined`: It means that instance is not loaded * * `null`: Value does not exist or some error occured while getting the value * */ //@ts-ignore var mmkvModule = TurboModuleRegistry.get('MMKVNative') mmkvModule.install() const mmkvJsiModule = global; exports.default = mmkvJsiModule;