UNPKG

@turnkey/core

Version:

A core JavaScript web and React Native package for interfacing with Turnkey's infrastructure.

26 lines (23 loc) 881 B
import { WebStorageManager } from './web/storage.mjs'; import { isReactNative, isWeb } from '../utils.mjs'; // TODO (Amir): Turn this into a class that extends StorageBase and make an init function. See stamper async function createStorageManager() { if (isReactNative()) { try { // Dynamic import to prevent bundling the native module in web environments const { MobileStorageManager } = await import('./mobile/storage.mjs'); return new MobileStorageManager(); } catch (error) { throw new Error(`Failed to load storage manager for react-native: ${error}`); } } else if (isWeb()) { return new WebStorageManager(); } else { throw new Error("Unsupported environment for storage manager."); } } export { createStorageManager }; //# sourceMappingURL=base.mjs.map