You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: types/splitio.d.ts
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -668,6 +668,52 @@ declare namespace SplitIO {
668
668
[statusinConsentStatus]: ConsentStatus;
669
669
};
670
670
}
671
+
/**
672
+
* Readiness Status interface. It represents the readiness state of an SDK client.
673
+
*/
674
+
interfaceReadinessStatus{
675
+
676
+
/**
677
+
* `isReady` indicates if the client has triggered an `SDK_READY` event and
678
+
* thus is ready to evaluate with cached data synchronized with the backend.
679
+
*/
680
+
isReady: boolean;
681
+
682
+
/**
683
+
* `isReadyFromCache` indicates if the client has triggered an `SDK_READY_FROM_CACHE` event and
684
+
* thus is ready to evaluate with cached data, although the data in cache might be stale.
685
+
*/
686
+
isReadyFromCache: boolean;
687
+
688
+
/**
689
+
* `isTimedout` indicates if the client has triggered an `SDK_READY_TIMED_OUT` event and is not ready to evaluate.
690
+
* In other words, `isTimedout` is equivalent to `hasTimedout && !isReady`.
691
+
*/
692
+
isTimedout: boolean;
693
+
694
+
/**
695
+
* `hasTimedout` indicates if the client has ever triggered an `SDK_READY_TIMED_OUT` event.
696
+
* It's meant to keep a reference that the SDK emitted a timeout at some point, not the current state.
697
+
*/
698
+
hasTimedout: boolean;
699
+
700
+
/**
701
+
* `isDestroyed` indicates if the client has been destroyed, i.e., `destroy` method has been called.
702
+
*/
703
+
isDestroyed: boolean;
704
+
705
+
/**
706
+
* `isOperational` indicates if the client can evaluate feature flags.
707
+
* In this state, `getTreatment` calls will not return `CONTROL` due to the SDK being unready or destroyed.
708
+
* It's equivalent to `(isReady || isReadyFromCache) && !isDestroyed`.
709
+
*/
710
+
isOperational: boolean;
711
+
712
+
/**
713
+
* `lastUpdate` indicates the timestamp of the most recent status event.
714
+
*/
715
+
lastUpdate: number;
716
+
}
671
717
/**
672
718
* Common API for entities that expose status handlers.
673
719
*/
@@ -676,6 +722,12 @@ declare namespace SplitIO {
676
722
* Constant object containing the SDK events for you to use.
677
723
*/
678
724
Event: EventConsts;
725
+
/**
726
+
* Gets the readiness status.
727
+
*
728
+
* @returns The current readiness status.
729
+
*/
730
+
getStatus(): ReadinessStatus;
679
731
/**
680
732
* Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
681
733
* 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 `ready` method will return a resolved promise once the SDK is ready.
0 commit comments