The end user requesting the feature flags.
Optional [[LDFlagsStateOptions]] to determine how the state is computed.
A Node-style callback to receive the result (as an [[LDFlagsState]]). If omitted, you will receive a Promise instead.
If you provided a callback, then nothing. Otherwise, a Promise which will be resolved with the result as an [[LDFlagsState]].
Determines the variation of a feature flag for a user.
The unique key of the feature flag.
The end user requesting the flag. The client will generate an analytics event to register this user with LaunchDarkly if the user does not already exist.
The default value of the flag, to be used if the value is not available from the KV store.
A Node-style callback to receive the result value. If omitted, you will receive a Promise instead.
If you provided a callback, then nothing. Otherwise, a Promise which will be resolved with the result value.
Determines the variation of a feature flag for a user, along with information about how it was calculated.
The reason
property of the result will also be included in analytics events, if you are
capturing detailed event data for this flag.
For more information, see the SDK reference guide.
The unique key of the feature flag.
The end user requesting the flag. The client will generate an analytics event to register this user with LaunchDarkly if the user does not already exist.
The default value of the flag, to be used if the value is not available from the KV store.
A Node-style callback to receive the result (as an [[LDEvaluationDetail]]). If omitted, you will receive a Promise instead.
If you provided a callback, then nothing. Otherwise, a Promise which will be resolved with the result (as an [[LDEvaluationDetail]]).
Returns a Promise that tracks the client's initialization state.
The Promise will be resolved if the client successfully initializes, or rejected if client
initialization has failed unrecoverably (for instance, if it detects that the SDK key is invalid).
Keep in mind that unhandled Promise rejections can be fatal in Node, so if you call this method,
be sure to attach a rejection handler to it (or, if using async
/await
, a catch block).
Note that you can also use event listeners ([[on]]) for the same purpose: the event "ready"
indicates success, and "failed"
indicates failure.
There is no built-in timeout for this method. If you want your code to stop waiting on the
Promise after some amount of time, you could use
Promise.race()
or one of the several NPM helper packages that provides a standard mechanism for this. Regardless
of whether you continue to wait, the SDK will still retry all connection failures indefinitely
unless it gets an unrecoverable error as described above.
A Promise that will be resolved if the client initializes successfully, or rejected if it fails. If successful, the result is the same client object.
Generated using TypeDoc
Builds an object that encapsulates the state of all feature flags for a given user. This includes the flag values and also metadata that can be used on the front end. This method does not send analytics events back to LaunchDarkly.
The most common use case for this method is to bootstrap a set of client-side feature flags from a back-end service. Call the
toJSON()
method of the returned object to convert it to the data structure used by the client-side SDK.