@launchdarkly/react-native-client-sdk
Version:
React Native LaunchDarkly SDK
131 lines • 5.89 kB
TypeScript
/**
* Determines the boolean variation of a feature flag.
*
* If the flag variation does not have a boolean value, defaultValue is returned.
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The boolean value.
*/
export declare const useBoolVariation: (key: string, defaultValue: boolean) => boolean;
/**
* Determines the boolean variation of a feature flag for a context, along with information about
* how it was calculated.
*
* The `reason` property of the result will also be included in analytics events, if you are
* capturing detailed event data for this flag.
*
* If the flag variation does not have a boolean value, defaultValue is returned. The reason will
* indicate an error of the type `WRONG_KIND` in this case.
*
* For more information, see the [SDK reference
* guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#react-native).
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The result (as an {@link LDEvaluationDetailTyped<boolean>}).
*/
export declare const useBoolVariationDetail: (key: string, defaultValue: boolean) => import("./LDEvaluationDetail").LDEvaluationDetailTyped<boolean>;
/**
* Determines the numeric variation of a feature flag.
*
* If the flag variation does not have a numeric value, defaultValue is returned.
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The numeric value.
*/
export declare const useNumberVariation: (key: string, defaultValue: number) => number;
/**
* Determines the numeric variation of a feature flag for a context, along with information about
* how it was calculated.
*
* The `reason` property of the result will also be included in analytics events, if you are
* capturing detailed event data for this flag.
*
* If the flag variation does not have a numeric value, defaultValue is returned. The reason will
* indicate an error of the type `WRONG_KIND` in this case.
*
* For more information, see the [SDK reference
* guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#react-native).
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The result (as an {@link LDEvaluationDetailTyped<number>}).
*/
export declare const useNumberVariationDetail: (key: string, defaultValue: number) => import("./LDEvaluationDetail").LDEvaluationDetailTyped<number>;
/**
* Determines the string variation of a feature flag.
*
* If the flag variation does not have a string value, defaultValue is returned.
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The string value.
*/
export declare const useStringVariation: (key: string, defaultValue: string) => string;
/**
* Determines the string variation of a feature flag for a context, along with information about
* how it was calculated.
*
* The `reason` property of the result will also be included in analytics events, if you are
* capturing detailed event data for this flag.
*
* If the flag variation does not have a string value, defaultValue is returned. The reason will
* indicate an error of the type `WRONG_KIND` in this case.
*
* For more information, see the [SDK reference
* guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#react-native).
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The result (as an {@link LDEvaluationDetailTyped<string>}).
*/
export declare const useStringVariationDetail: (key: string, defaultValue: string) => import("./LDEvaluationDetail").LDEvaluationDetailTyped<string>;
/**
* Determines the json variation of a feature flag.
*
* This version may be favored in TypeScript versus `variation` because it returns
* an `unknown` type instead of `any`. `unknown` will require a cast before usage.
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* The json value.
*/
export declare const useJsonVariation: (key: string, defaultValue: unknown) => unknown;
/**
* Determines the json variation of a feature flag for a context, along with information about how it
* was calculated.
*
* The `reason` property of the result will also be included in analytics events, if you are
* capturing detailed event data for this flag.
*
* This version may be favored in TypeScript versus `variation` because it returns
* an `unknown` type instead of `any`. `unknown` will require a cast before usage.
*
* For more information, see the [SDK reference
* guide](https://docs.launchdarkly.com/sdk/features/evaluation-reasons#react-native).
*
* @param key The unique key of the feature flag.
* @param defaultValue The default value of the flag, to be used if the value is not available
* from LaunchDarkly.
* @returns
* If you provided a callback, then nothing. Otherwise, a Promise which will be resolved with
* the result (as an{@link LDEvaluationDetailTyped<unknown>}).
*/
export declare const useJsonVariationDetail: (key: string, defaultValue: unknown) => import("./LDEvaluationDetail").LDEvaluationDetailTyped<unknown>;
//# sourceMappingURL=useVariation.d.ts.map