# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.electricbolt.co.nz/getting-started/react-native-integration/javascript-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
