Skip to content

Commit eafddc6

Browse files
committed
Correct hook intellisense docs
1 parent 9e1ec80 commit eafddc6

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/ConfigCatClient.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ export interface IConfigCatClient extends IProvidesHooks {
8585
forceRefreshAsync(): Promise<RefreshResult>;
8686

8787
/**
88-
* Waits for the client initialization.
89-
* @returns A promise that fulfills with the client's initialization state.
88+
* Waits for the client to reach the ready state, i.e. to complete initialization.
89+
*
90+
* @remarks Ready state is reached as soon as the initial sync with the external cache (if any) completes.
91+
* If this does not provide up-to-date config data, and the client is online (i.e. HTTP requests are allowed),
92+
* the first config fetch operation is also awaited in Auto Poll mode before ready state is reported.
93+
*
94+
* That is, reaching the ready state usually means that the client is ready to evaluate feature flags.
95+
* However, please note that it is not guaranteed. You can determine this by checking the return value.
96+
*
97+
* @returns A promise that fulfills with the state of the local cache at the time initialization was completed.
9098
*/
9199
waitForReady(): Promise<ClientCacheState>;
92100

src/Hooks.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ import type { IEvaluationDetails } from "./RolloutEvaluator";
66

77
/** Hooks (events) that can be emitted by `ConfigCatClient`. */
88
export type HookEvents = {
9-
/** Occurs when the client is ready to provide the actual value of feature flags or settings. */
9+
/**
10+
* Occurs when the client reaches the ready state, i.e. completes initialization.
11+
*
12+
* @remarks Ready state is reached as soon as the initial sync with the external cache (if any) completes.
13+
* If this does not produce up-to-date config data, and the client is online (i.e. HTTP requests are allowed),
14+
* the first config fetch operation is also awaited in Auto Poll mode before ready state is reported.
15+
*
16+
* That is, reaching the ready state usually means that the client is ready to evaluate feature flags.
17+
* However, please note that it is not guaranteed. You can determine this by checking the `cacheState` parameter.
18+
*/
1019
clientReady: [cacheState: ClientCacheState];
1120
/** Occurs after the value of a feature flag of setting has been evaluated. */
1221
flagEvaluated: [evaluationDetails: IEvaluationDetails];

0 commit comments

Comments
 (0)