@openfeature/web-sdk
Advanced tools
Comparing version 0.3.8-experimental to 0.3.9-experimental
@@ -269,7 +269,22 @@ declare enum ProviderEvents { | ||
/** | ||
* The state of the provider. | ||
*/ | ||
declare enum ProviderStatus { | ||
/** | ||
* The provider has not been initialized and cannot yet evaluate flags. | ||
*/ | ||
NOT_READY = "NOT_READY", | ||
/** | ||
* The provider is ready to resolve flags. | ||
*/ | ||
READY = "READY", | ||
/** | ||
* The provider is in an error state and unable to evaluate flags. | ||
*/ | ||
ERROR = "ERROR" | ||
} | ||
/** | ||
* Static data about the provider. | ||
*/ | ||
interface ProviderMetadata extends Metadata { | ||
@@ -280,2 +295,10 @@ readonly name: string; | ||
readonly metadata: ProviderMetadata; | ||
/** | ||
* Returns a representation of the current readiness of the provider. | ||
* If the provider needs to be initialized, it should return {@link ProviderStatus.READY}. | ||
* If the provider is in an error state, it should return {@link ProviderStatus.ERROR}. | ||
* If the provider is functioning normally, it should return {@link ProviderStatus.NOT_READY}. | ||
* | ||
* _Providers which do not implement this method are assumed to be ready immediately._ | ||
*/ | ||
readonly status?: ProviderStatus; | ||
@@ -287,6 +310,10 @@ /** | ||
events?: OpenFeatureEventEmitter; | ||
/** | ||
* A function used to shut down the provider. | ||
* Called when this provider is replaced with a new one, or when the OpenFeature is shut down. | ||
*/ | ||
onClose?(): Promise<void>; | ||
/** | ||
* A handler function used to setup the provider. | ||
* Called by the SDK after the provider is set. | ||
* A function used to setup the provider. | ||
* Called by the SDK after the provider is set if the provider's status is {@link ProviderStatus.NOT_READY}. | ||
* When the returned promise resolves, the SDK fires the ProviderEvents.Ready event. | ||
@@ -293,0 +320,0 @@ * If the returned promise rejects, the SDK fires the ProviderEvents.Error event. |
{ | ||
"name": "@openfeature/web-sdk", | ||
"version": "0.3.8-experimental", | ||
"version": "0.3.9-experimental", | ||
"description": "OpenFeature SDK for Web", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
302679
3186