> For the complete documentation index, see [llms.txt](https://docs.electricbolt.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.electricbolt.co.nz/getting-started/react-native-integration/javascript-integration.md).

# 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](/api/react-native-api.md) for the list of APIs available.
