Interface LDReactClientOptions

Initialization options for the LaunchDarkly React SDK.

Hierarchy

Properties

allAttributesPrivate?: boolean
applicationInfo?: {
    id?: string;
    name?: string;
    version?: string;
    versionName?: string;
}

Type declaration

  • Optional id?: string
  • Optional name?: string
  • Optional version?: string
  • Optional versionName?: string
automaticBackgroundHandling?: boolean

Determines if the SDK responds to entering different visibility states, such as foreground and background. An example is flushing buffered events when going to the background.

This is true by default. Generally speaking the SDK will be able to most reliably deliver events with this setting on.

It may be useful to disable for environments where not all window/document objects are available, such as when running the SDK in a browser extension.

baseUri?: string
capacity?: number
cleanOldPersistentData?: boolean

Configuration for the FDv2 data system. When present, the SDK uses the FDv2 protocol for flag delivery instead of the default FDv1 protocol.

The browser SDK restricts automaticModeSwitching to false or ManualModeSwitching only -- automatic switching has no effect in browser environments.

This option is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode

debug?: boolean
diagnosticOptOut?: boolean
diagnosticRecordingInterval?: number
disableCache?: boolean
eventUrlTransformer?: ((url) => string)

Type declaration

    • (url): string
    • A function which, if present, can change the URL in analytics events to something other than the actual browser URL. It will be called with the current browser URL as a parameter, and returns the value that should be stored in the event's url property.

      It may be useful to customize the url to provide specific meaning, incorporate client-side routing concerns, or redact tokens or other info.

      Parameters

      • url: string

      Returns string

eventsUri?: string
fetchGoals?: boolean

Whether the client should make a request to LaunchDarkly for Experimentation metrics (goals).

This is true by default, meaning that this request will be made on every page load. Set it to false if you are not using Experimentation and want to skip the request.

flushInterval?: number
hooks?: Hook[]
inspectors?: LDInspection[]
logger?: LDLogger
maxCachedContexts?: number
payloadFilterKey?: string
plugins?: LDPlugin[]

A list of plugins to be used with the SDK.

pollInterval?: number
privateAttributes?: string[]
sendEvents?: boolean
storage?: LDStorage

Custom storage implementation.

Storage is used for caching flag values for a context as well as persisting generated identifiers.

By default the browser SDK uses window.localStorage.

Remarks

If there is an issue with the storage implementation, then generated keys and context caches may not be persisted. This will cause the SDK to generate new keys and context caches on every startup. Implementations should not throw; if one does, the SDK logs the error and degrades gracefully rather than crashing the application.

streamInitialReconnectDelay?: number
streamUri?: string
streaming?: boolean

Whether or not to open a streaming connection to LaunchDarkly for live flag updates.

If this is true, the client will always attempt to maintain a streaming connection; if false, it never will. If you leave the value undefined (the default), the client will open a streaming connection if you subscribe to "change" or "change:flag-key" events.

This is equivalent to calling client.setStreaming() with the same value.

useCamelCaseFlagKeys?: boolean

Whether the React SDK should transform flag keys into camel-cased format. Using camel-cased flag keys allow for easier use as prop values, however, these keys won't directly match the flag keys as known to LaunchDarkly. Consequently, flag key collisions may be possible and the Code References feature will not function properly.

This is true by default, meaning that keys will automatically be converted to camel-case.

For more information, see the React SDK Reference Guide on flag keys.

Deprecated

This option is deprecated and will be removed in a future major version.

See

https://docs.launchdarkly.com/sdk/client-side/react/react-web#flag-keys

useReport?: boolean
withReasons?: boolean
wrapperName?: string
wrapperVersion?: string

Generated using TypeDoc