JavaScript integration

To access AppfigurateLibrary from JavaScript, import NativeModules and NativeEventEmitter, then define Appfigurate and AppfigurateEvents:

import {
  NativeModules,
  NativeEventEmitter,
} from 'react-native';

const {Appfigurate} = NativeModules;
const AppfigurateEvents = new NativeEventEmitter(NativeModules.Appfigurate);

You can now access your app's configuration using the following:

let serverURL = await Appfigurate.nativeValue('serverURL') // dev.appfigurate.com
let debugLogging = await Appfigurate.nativeValue('debugLogging')); // false

To be notified when the configuration is changed at runtime:

AppfigurateEvents.addListener('APLConfigurationUpdated', result => {
  // do something
});

See also React Native API for the list of APIs available.

Last updated