# JavaScript integration

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

```javascript
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:

```javascript
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:

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

See also [React Native API](https://docs.electricbolt.co.nz/api/react-native-api) for the list of APIs available.
