UNPKG

react-native-ibm-mobilefirst-liveupdate

Version:

React Native SDK for IBM Mobile liveupdate. Works with IBM Mobile First.

52 lines (41 loc) 1.41 kB
/* Licensed Materials - Property of IBM * 5725-I43 (C) Copyright IBM Corp. 2020. All Rights Reserved. * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* Author - Manjunath Kallannavar | manjunathkavar@in.ibm.com */ import { NativeModules } from 'react-native'; import { _mandatoryParam, _checkParamType } from './Utils'; import Configuration from './Configuration'; var liveUpdate = NativeModules.RNLiveUpdate; class MFLiveUpdate { constructor() { } /** * Obtain the LiveUpdate Configuration object from a server * @param useClientCache - true (default) tells the native iOS/Android code if we want to cache the result of the calls. cache expiratrion * is set in the MFP admin console. */ async obtainConfiguration(useClientCache) { if (useClientCache == undefined) { useClientCache = true; } else { _checkParamType(useClientCache, 'boolean'); } return new Promise((resolve, reject) => { liveUpdate.obtainConfiguration(useClientCache).then(result => { var conf = new Configuration(result); resolve(conf); }) .catch(err => { reject(err); }); }) } } export default MFLiveUpdate;