Feature Flag Methods
Methods for working with feature flags and A/B testing.getFeatureFlag
Get the value of a feature flag. The value can be a boolean, string, number, or object.Feature flag key.
Optional configuration:
defaultValue: Default value if flag is not foundskipTracking: Skip automatic exposure tracking
Returns
T | undefined - The flag value, or undefined if not found and no default provided.
Example
isFeatureEnabled
Check if a feature flag is enabled (returns a boolean).Feature flag key.
Optional configuration:
defaultValue: Default value if flag is not found (defaults tofalse)skipTracking: Skip automatic exposure tracking
Returns
boolean - true if the feature is enabled, false otherwise.
Example
getExperimentVariant
Get the assigned variant for an A/B test experiment.Experiment key.
Optional configuration:
defaultValue: Default variant if experiment is not foundskipTracking: Skip automatic exposure tracking
Returns
string | undefined - The variant key, or undefined if not found and no default provided.
Example
getAllFlags
Get all feature flags and experiments at once.Returns
Record<string, FeatureFlag> - Object mapping flag keys to flag objects.
Example
reloadFeatureFlags
Manually reload feature flags from the server.Optional updated user properties for targeting. If provided, flags will be re-evaluated with these properties.
Returns
Promise<void>
