-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathLDClient.ts
More file actions
38 lines (37 loc) · 1.49 KB
/
LDClient.ts
File metadata and controls
38 lines (37 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {
LDClient as CommonClient,
LDContext,
LDIdentifyOptions,
} from '@launchdarkly/js-client-sdk-common';
/**
* React Native LDClient type. Overrides `identify()` to return `Promise<void>` and throw on
* error/timeout to maintain backward compatibility with existing React Native consumers.
*/
export type LDClient = Omit<CommonClient, 'identify'> & {
/**
* Identifies a context to LaunchDarkly.
*
* Unlike the server-side SDKs, the client-side JavaScript SDKs maintain a current context state,
* which is set when you call `identify()`.
*
* Changing the current context also causes all feature flag values to be reloaded. Until that has
* finished, calls to {@link variation} will still return flag values for the previous context. You can
* await the Promise to determine when the new flag values are available.
*
* @param context
* The LDContext object.
* @param identifyOptions
* Optional configuration. Please see {@link LDIdentifyOptions}.
* @returns
* A Promise which resolves when the flag values for the specified
* context are available. It rejects when:
*
* 1. The context is unspecified or has no key.
*
* 2. The identify timeout is exceeded. In client SDKs this defaults to 5s.
* You can customize this timeout with {@link LDIdentifyOptions | identifyOptions}.
*
* 3. A network error is encountered during initialization.
*/
identify(context: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void>;
};