Skip to content

Commit e2179d7

Browse files
Polishing
1 parent 13eaec3 commit e2179d7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/readiness/readinessManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function readinessManagerFactory(
9090
if (!isReady && !isDestroyed) {
9191
try {
9292
syncLastUpdate();
93-
gate.emit(SDK_READY_FROM_CACHE);
93+
gate.emit(SDK_READY_FROM_CACHE, isReady);
9494
} catch (e) {
9595
// throws user callback exceptions in next tick
9696
setTimeout(() => { throw e; }, 0);
@@ -116,7 +116,7 @@ export function readinessManagerFactory(
116116
syncLastUpdate();
117117
if (!isReadyFromCache) {
118118
isReadyFromCache = true;
119-
gate.emit(SDK_READY_FROM_CACHE);
119+
gate.emit(SDK_READY_FROM_CACHE, isReady);
120120
}
121121
gate.emit(SDK_READY);
122122
} catch (e) {

types/splitio.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,16 +772,17 @@ declare namespace SplitIO {
772772
ready(): Promise<void>;
773773
/**
774774
* Returns a promise that resolves once the SDK is ready for evaluations using cached data synchronized with the backend (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
775-
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `whenReady` method will return a resolved promise once the SDK is ready.
775+
* As it's meant to provide similar flexibility than event listeners, given that the SDK might be ready after a timeout event, the `whenReady` method will return a resolved promise once the SDK is ready.
776776
*
777-
* @returns A promise that resolves once the SDK is ready or rejects if the SDK has timedout.
777+
* @returns A promise that resolves once the SDK_READY event is emitted or rejects if the SDK has timedout.
778778
*/
779779
whenReady(): Promise<void>;
780780
/**
781781
* Returns a promise that resolves once the SDK is ready for evaluations using cached data which might not yet be synchronized with the backend (`SDK_READY_FROM_CACHE` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
782-
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready from cache after a timeout event, the `whenReadyFromCache` method will return a resolved promise once the SDK is ready from cache.
782+
* As it's meant to provide similar flexibility than event listeners, given that the SDK might be ready from cache after a timeout event, the `whenReadyFromCache` method will return a resolved promise once the SDK is ready from cache.
783783
*
784-
* @returns A promise that resolves once the SDK is ready from cache or rejects if the SDK has timedout. The promise resolves with a boolean value that indicates whether the SDK is ready (synchronized with the backend) or not.
784+
* @returns A promise that resolves once the SDK_READY_FROM_CACHE event is emitted or rejects if the SDK has timedout. The promise resolves with a boolean value that
785+
* indicates whether the SDK_READY_FROM_CACHE event was emitted together with the SDK_READY event (i.e., the SDK is ready and synchronized with the backend) or not.
785786
*/
786787
whenReadyFromCache(): Promise<boolean>;
787788
}

0 commit comments

Comments
 (0)