No results for ""
EXPAND ALL
  • Home
  • API docs

Inspectors

Read time: 2 minutes
Last edited: Feb 08, 2024

Overview

This topic explains how to configure inspectors for client-side JavaScript LaunchDarkly SDKs.

Inspector types

There are different types of inspectors you can provide when configuring the JavaScript SDK. They are intended for monitoring, analytics, or debugging purposes. The application should not use these interfaces to access flags for the purpose of controlling application flow.

These are the inspector types:

  • Flag Used
  • Flag Details Changed
  • Flag Detail Changed

Details about each SDK's configuration are available in the SDK-specific sections below:

  • JavaScript
  • React Native: The React Native SDK relies on the JavaScript SDK for user-related functionality.
  • React Web: The React Web SDK relies on the JavaScript SDK for user-related functionality.

JavaScript

Expand JavaScript code sample

The inspector type defines when in the SDK lifecycle it calls the method callback, and with what arguments.

To configure a Flag Used inspector, set type to flag-used and pass in a method that matches the expected signature:

const client = LDClient.initialize(
'client-side-id-123abc',
context,
options = {
inspectors: [
{
type: 'flag-used',
name: 'example-flag-used',
method: (flagKey, flagDetail) => {
console.log(flagKey)
console.log(flagDetail)
}
}
]
}
};

React Native

All inspector-related functionality provided by the JavaScript SDK is also available in version 8.x and 9.x of the React Native SDK. This functionality is not available in version 10 of the React Native SDK.

React Web

All inspector-related functionality provided by the JavaScript SDK is also available in the React Web SDK.