Describes the reason that a flag evaluation produced a particular value. This is part of the LDEvaluationDetail object returned by LDClient.variationDetail.
Will be null when <a href="interfaces/_launchdarkly_js_client_sdk_.ldoptions.html#evaluationreasons">LDOptions.evaluationReasons</a>
is false
.
The types of values a feature flag can have.
Flags can have any JSON-serializable value.
The current version string of the SDK.
A basic implementation of logging that uses the global console
object. This is used by
default in the browser SDK. It sends messages of "debug", "info", "warn", or "error"
level (if enable) to console.log()
, console.info()
, console.warn()
, and console.error()
respectively.
To make LDClient use this logger, put it in the logger
property of LDOptions.
Creates an instance of the LaunchDarkly client.
The client will begin attempting to connect to LaunchDarkly as soon as it is created. To
determine when it is ready to use, call LDClient.waitForInitialization, or register an
event listener for the "ready"
event using LDClient.on.
Note that you can either import this as a named export or as part of the default exports, although the latter is deprecated:
// Preferred usage:
import { initialize } from 'launchdarkly-js-client-sdk';
const client = initialize(envKey, user, options);
// Deprecated usage:
import LaunchDarkly from 'launchdarkly-js-client-sdk';
const client = LaunchDarkly.initialize(envKey, user, options);
The environment ID.
The initial user properties. These can be changed later with LDClient.identify.
Optional configuration settings.
The new client instance.
Generated using TypeDoc
This is the API reference for the LaunchDarkly SDK for browser JavaScript.
In typical usage, you will call initialize once at startup time to obtain an instance of LDClient, which provides access to all of the SDK's functionality.
For more information, see the SDK reference guide.