@ua/react-native-airship
Version:
Airship plugin for React Native apps.
51 lines • 1.88 kB
TypeScript
import { FeatureFlag } from './types';
/**
* Airship feature flag manager.
*/
export declare class AirshipFeatureFlagManager {
private readonly module;
/**
* Feature flag cache.
*/
readonly resultCache: AirshipFeatureFlagResultCache;
constructor(module: any);
/**
* Retrieve a given flag's status and associated data by its name.
* @param {string} flagName The flag name
* @param {boolean} useResultCache If the response should use result cache or not.
* @return {Promise<FeatureFlag>} A promise resolving to the feature flag requested.
* @throws {Error} when failed to fetch
*/
flag(flagName: string, useResultCache?: boolean): Promise<FeatureFlag>;
/**
* Tracks a feature flag interaction event.
* @param {FeatureFlag} flag The flag
* @return {Promise<Void>} A promise with an empty result.
* @throws {Error} when failed to fetch
*/
trackInteraction(flag: FeatureFlag): Promise<void>;
}
export declare class AirshipFeatureFlagResultCache {
private readonly module;
constructor(module: any);
/**
* Retrieve a flag from the cache.
* @param {string} flagName The flag name
* @return {Promise<FeatureFlag>} A promise resolving to the feature flag.
*/
flag(flagName: string): Promise<FeatureFlag>;
/**
* Caches a feature flag.
* @param {FeatureFlag} flag The flag
* @param {FeatureFlag} ttl Cache TTL in milliseconds.
* @return {Promise<Void>} A promise with an empty result.
*/
cache(flag: FeatureFlag, ttl: number): Promise<void>;
/**
* Clears the cache for a given flag.
* @param {FeatureFlag} flagName The flag name
* @return {Promise<Void>} A promise with an empty result.
*/
removeCachedFlag(flagName: string): Promise<void>;
}
//# sourceMappingURL=AirshipFeatureFlagManager.d.ts.map