Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "launchdarkly-react-native-client-sdk"

This is the API reference for the LaunchDarkly Client-Side SDK for React Native.

In typical usage, you will instantiate LDClient and then call configure once at startup time to set up your connection to LaunchDarkly.

For more information, see the SDK reference guide.

Index

Type aliases

LDClientConfig

LDClientConfig: { backgroundPollingIntervalMillis?: undefined | number; baseUri?: undefined | string; connectionTimeoutMillis?: undefined | number; debugMode?: undefined | false | true; disableBackgroundUpdating?: undefined | false | true; evaluationReasons?: undefined | false | true; eventsCapacity?: undefined | number; eventsFlushIntervalMillis?: undefined | number; eventsUri?: undefined | string; mobileKey: string; offline?: undefined | false | true; pollingIntervalMillis?: undefined | number; stream?: undefined | false | true; streamUri?: undefined | string; useReport?: undefined | false | true }

Configuration options for the LaunchDarkly React Native SDK.

Type declaration

  • Optional backgroundPollingIntervalMillis?: undefined | number

    The interval by which the SDK polls for flag updates when the application is in the background.

    The default value is 3600000ms (1 hour).

  • Optional baseUri?: undefined | string

    The base URI for the LaunchDarkly server.

    Most users should use the default value.

  • Optional connectionTimeoutMillis?: undefined | number

    The timeout interval for connecting to LaunchDarkly for flag requests and event reports.

    The default value is 10000ms (10 seconds).

  • Optional debugMode?: undefined | false | true

    Controls information logged to the console, and modifying some setting ranges to facilitate debugging.

    This setting is only used when running in iOS. In Android this setting is ignored.

    The default value is false.

  • Optional disableBackgroundUpdating?: undefined | false | true

    Whether or not the SDK should attempt to check for flag updates while the application runs in the background.

    If this is true, the client will periodically poll for updates while in the background; if false, the SDK will not attempt to receive updates while the app is backgrounded.

    The default value is false.

  • Optional evaluationReasons?: undefined | false | true

    Whether LaunchDarkly should provide additional information about how flag values were calculated.

    The additional information will then be available through the client's LDClient.*VariationDetail methods. Since this increases the size of network requests, such information is not sent unless you set this option to true.

  • Optional eventsCapacity?: undefined | number

    The capacity of the analytics events queue.

    The client buffers up to this many events in memory before flushing. If the capacity is exceeded before the queue is flushed, events will be discarded. Increasing the capacity means that events are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage flag evaluations do not produce individual events, only summary counts, so you only need a large capacity if you are generating a large number of click, pageview, or identify events (or if you are using the event debugger).

    The default value is 100.

  • Optional eventsFlushIntervalMillis?: undefined | number

    The interval in between flushes of the analytics events queue, in milliseconds.

    The default value is 30000ms (30 seconds).

  • Optional eventsUri?: undefined | string

    The base URI for the LaunchDarkly events server.

    Most users should use the default value.

  • mobileKey: string

    The mobile SDK key associated with your LaunchDarkly environment.

    This field is required as the React Native SDK will use this value to uniquely identify your LaunchDarkly account.

  • Optional offline?: undefined | false | true

    Disables all network calls from the LaunchDarkly SDK.

    This can also be specified after the client has been created, using LDClient.setOffline().

    The default value is true (the client will make network calls).

  • Optional pollingIntervalMillis?: undefined | number

    The interval by which the SDK polls for flag updates when the application is in the foreground. This property is only used if is the streaming connection is disabled.

    The default value is 300000ms (5 min).

  • Optional stream?: undefined | false | true

    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.

    The default value is true.

  • Optional streamUri?: undefined | string

    The base URI for the LaunchDarkly streaming server.

    Most users should use the default value.

  • Optional useReport?: undefined | false | true

    Whether or not to use the REPORT verb to fetch flag settings.

    If this is true, flag settings will be fetched with a REPORT request including a JSON entity body with the user object.

    Otherwise (by default) a GET request will be issued with the user passed as a base64 URL-encoded path parameter.

    Do not use unless advised by LaunchDarkly.

LDEvaluationDetail

LDEvaluationDetail<T>: { reason: LDEvaluationReason; value: T; variationIndex?: undefined | number }

An object that combines the result of a feature flag evaluation with information about how it was calculated.

This is the result of calling one of the LDClient.*VariationDetail methods.

For more information, see the documentation.

Type parameters

  • T

    The type of flag being evaluated.

Type declaration

  • reason: LDEvaluationReason

    An object describing the main factor that influenced the flag evaluation value.

  • value: T

    The result of the flag evaluation. This will be either one of the flag's variations or the default value that was passed to the variation detail function.

  • Optional variationIndex?: undefined | number

    The index of the returned value within the flag's list of variations, e.g. 0 for the first variation-- or null if the default value was returned.

LDEvaluationReason

Describes the reason that a flag evaluation produced a particular value. This is part of the LDEvaluationDetail object returned by the variation detail methods.

LDEvaluationReasonError

LDEvaluationReasonError: { errorKind: LDEvaluationReasonErrorKind; kind: ERROR }

The flag could not be evaluated, so the default value was returned.

Type declaration

LDEvaluationReasonFallthrough

LDEvaluationReasonFallthrough: { kind: FALLTHROUGH }

The flag is on, but the user did not match any targets or rules, so it returned the value that appears on the dashboard under "Default rule."

Type declaration

LDEvaluationReasonOff

LDEvaluationReasonOff: { kind: OFF }

The flag is off and therefore returned its configured off value.

Type declaration

LDEvaluationReasonPrerequisiteFailed

LDEvaluationReasonPrerequisiteFailed: { kind: PREREQUISITE_FAILED; prerequisiteKey: string }

The flag had at least one prerequisite flag that either was off or did not return the desired variation. Because of this, the flag returned its "off" value.

Type declaration

  • kind: PREREQUISITE_FAILED
  • prerequisiteKey: string

    The key of the prerequisite flag that failed.

LDEvaluationReasonRuleMatch

LDEvaluationReasonRuleMatch: { kind: RULE_MATCH; ruleId: string; ruleIndex: number }

The user who encountered the flag matched one of the flag's rules.

Type declaration

  • kind: RULE_MATCH
  • ruleId: string

    The rule's unique identifier, which stays the same even if you rearrange the order of the rules.

  • ruleIndex: number

    The positional index of the matched rule (0 for the first rule).

LDEvaluationReasonTargetMatch

LDEvaluationReasonTargetMatch: { kind: TARGET_MATCH }

The user key was specifically targeted for this flag in the "Target individual users" section.

Type declaration

LDUserConfig

LDUserConfig: { anonymous?: undefined | false | true; country?: undefined | string; custom?: undefined | {}; email?: undefined | string; firstName?: undefined | string; key: string; lastName?: undefined | string; name?: undefined | string; privateAttributeNames?: string[] }

A LaunchDarkly user object.

Type declaration

  • Optional anonymous?: undefined | false | true

    Whether to show the user on the Users page in LaunchDarkly.

    The default value is false.

  • Optional country?: undefined | string

    The country associated with the user.

  • Optional custom?: undefined | {}

    Any additional attributes associated with the user.

  • Optional email?: undefined | string

    The user's email address.

  • Optional firstName?: undefined | string

    The user's first name.

  • key: string

    A unique string identifying a user.

  • Optional lastName?: undefined | string

    The user's last name.

  • Optional name?: undefined | string

    The user's name.

    You can search for users on the User page by name.

  • Optional privateAttributeNames?: string[]

    Specifies a list of attribute names (either built-in or custom) which should be marked as private, and not sent to LaunchDarkly in analytics events.

Generated using TypeDoc