Skip to content

Commit 215721d

Browse files
authored
chore: checking documentation (#658)
1 parent aee09c8 commit 215721d

File tree

6 files changed

+54
-15
lines changed

6 files changed

+54
-15
lines changed

packages/sdk/browser/src/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* In typical usage, you will call {@link initialize} once at startup time to obtain an instance of
77
* {@link LDClient}, which provides access to all of the SDK's functionality.
88
*
9-
* For more information, see the SDK reference guide.
9+
* For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/javascript).
1010
*
1111
* @packageDocumentation
1212
*/
@@ -74,11 +74,11 @@ export type {
7474
* Usage:
7575
* ```
7676
* import { initialize } from 'launchdarkly-js-client-sdk';
77-
* const client = initialize(envKey, context, options);
77+
* const client = initialize(clientSideId, context, options);
7878
* ```
7979
*
8080
* @param clientSideId
81-
* The client-side id, also known as the environment ID.
81+
* The client-side ID, also known as the environment ID.
8282
* @param options
8383
* Optional configuration settings.
8484
* @return
@@ -90,10 +90,11 @@ export function initialize(clientSideId: string, options?: LDOptions): LDClient
9090
}
9191

9292
/**
93-
* Provides a simple {@link LDLogger} implementation.
93+
* Provides a basic {@link LDLogger} implementation.
9494
*
95-
* This logging implementation uses a simple format that includes only the log level
96-
* and the message text. By default the output is written to `console.error`.
95+
* This logging implementation uses a basic format that includes only the log level
96+
* and the message text. By default this uses log level 'info' and the output is
97+
* written to `console.error`.
9798
*
9899
* To use the logger created by this function, put it into {@link LDOptions.logger}. If
99100
* you do not set {@link LDOptions.logger} to anything, the SDK uses a default logger

packages/sdk/browser/src/options.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export interface BrowserOptions extends Omit<LDOptionsBase, 'initialConnectionMo
2424
* A function which, if present, can change the URL in analytics events to something other
2525
* than the actual browser URL. It will be called with the current browser URL as a parameter,
2626
* and returns the value that should be stored in the event's `url` property.
27+
*
28+
* It may be useful to customize the `url` to provide specific meaning, incorporate
29+
* client-side routing concerns, or redact tokens or other info.
2730
*/
2831
eventUrlTransformer?: (url: string) => string;
2932

@@ -39,10 +42,10 @@ export interface BrowserOptions extends Omit<LDOptionsBase, 'initialConnectionMo
3942
streaming?: boolean;
4043

4144
/**
42-
* Determines if the SDK responds to entering different visibility states to handle tasks such as
43-
* flushing events.
45+
* Determines if the SDK responds to entering different visibility states, such as foreground and background.
46+
* An example is flushing buffered events when going to the background.
4447
*
45-
* This is true by default. Generally speaking the SDK will be able to most reliably delivery
48+
* This is true by default. Generally speaking the SDK will be able to most reliably deliver
4649
* events with this setting on.
4750
*
4851
* It may be useful to disable for environments where not all window/document objects are

packages/shared/common/src/api/context/LDContext.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ import { LDSingleKindContext } from './LDSingleKindContext';
33
import { LDUser } from './LDUser';
44

55
/**
6-
* A LaunchDarkly context object.
6+
* A LaunchDarkly context object. LaunchDarkly contexts are objects representing users, devices, organizations, and
7+
* other entities that feature flags serve different variations to according to your flag targeting rules. These data
8+
* objects contain context attributes that describe what you know about that context, such as their name, location,
9+
* device type, or organization they are associated with.
10+
*
11+
* You can manage how contexts interact with your app by targeting flag variations to specific contexts, based on
12+
* their context attributes. When a flag evaluation occurs, the feature flag uses the evaluation context to understand
13+
* what variation to serve. You can be as specific as targeting a flag to a single end context, or as broad as targeting
14+
* your entire customer base. You can even use anonymous contexts and private attributes to control what data to
15+
* include or exclude in the information you collect about your end users.
16+
*
17+
* LDContext is the newer replacement for the previous, less flexible LDUser type. The current SDK still supports
18+
* LDUser, but LDContext is now the preferred model.
19+
*
20+
* See {@link LDSingleKindContext} and {@link LDMultiKindContext} for examples. {@link LDContextCommon} includes
21+
* additional propert
722
*/
823
export type LDContext = LDUser | LDSingleKindContext | LDMultiKindContext;

packages/shared/common/src/api/context/LDContextCommon.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { LDContextMeta } from './LDContextMeta';
22

3+
/**
4+
* Common attributes shared by the various context types.
5+
*/
36
export interface LDContextCommon {
47
/**
58
* A unique string identifying a context.

packages/shared/common/src/api/platform/AutoEnv.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* model, operating system, locale, and so on. We recommend enabling this when you configure the SDK. To learn more,
77
* read [Automatic environment attributes](https://docs.launchdarkly.com/sdk/features/environment-attributes).
88
* for more documentation.
9-
*
10-
* The default is disabled.
119
*/
1210
export enum AutoEnvAttributes {
1311
Disabled,

packages/shared/sdk-client/src/api/integrations/Hooks.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ import { LDEvaluationDetail } from '../LDEvaluationDetail';
66
* Contextual information provided to evaluation stages.
77
*/
88
export interface EvaluationSeriesContext {
9+
/**
10+
* The flag key the evaluation is for.
11+
*/
912
readonly flagKey: string;
1013
/**
1114
* Optional in case evaluations are performed before a context is set.
1215
*/
1316
readonly context?: LDContext;
17+
/**
18+
* The default value that was provided.
19+
*/
1420
readonly defaultValue: unknown;
1521

1622
/**
@@ -33,13 +39,19 @@ export interface EvaluationSeriesData {
3339
* Meta-data about a hook implementation.
3440
*/
3541
export interface HookMetadata {
42+
/**
43+
* Name of the hook.
44+
*/
3645
readonly name: string;
3746
}
3847

3948
/**
40-
* Contextual information provided to evaluation stages.
49+
* Contextual information provided to identify stages.
4150
*/
4251
export interface IdentifySeriesContext {
52+
/**
53+
* The context associated with the identify operation.
54+
*/
4355
readonly context: LDContext;
4456
/**
4557
* The timeout, in seconds, associated with the identify operation.
@@ -48,7 +60,7 @@ export interface IdentifySeriesContext {
4860
}
4961

5062
/**
51-
* Implementation specific hook data for evaluation stages.
63+
* Implementation specific hook data for identify stages.
5264
*
5365
* Hook implementations can use this to store data needed between stages.
5466
*/
@@ -58,13 +70,20 @@ export interface IdentifySeriesData {
5870

5971
/**
6072
* The status an identify operation completed with.
73+
*
74+
* An example in which an error may occur is lack of network connectivity
75+
* preventing the SDK from functioning.
6176
*/
6277
export type IdentifySeriesStatus = 'completed' | 'error';
6378

6479
/**
6580
* The result applies to a single identify operation. An operation may complete
6681
* with an error and then later complete successfully. Only the first completion
67-
* will be executed in the evaluation series.
82+
* will be executed in the identify series.
83+
*
84+
* For example, a network issue may cause an identify to error since the SDK
85+
* can't refresh its cached data from the cloud at that moment, but then later
86+
* the when the network issue is resolved, the SDK will refresh cached data.
6887
*/
6988
export interface IdentifySeriesResult {
7089
status: IdentifySeriesStatus;

0 commit comments

Comments
 (0)