UNPKG

@turnkey/core

Version:

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

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