getConfig()
Get configuration value synchronously from cache or defaults.key- Configuration key
undefined
Example:
- Returns cached value instantly
- Returns default if provided
- Returns
undefinedif not found - Triggers background refresh
getAllConfigs()
Get all configurations synchronously.getConfigAsync()
Get configuration value asynchronously with cache-first strategy.key- Configuration keyoptions.properties- User properties for personalizationoptions.forceRefresh- Skip cache, fetch from APIoptions.immediateKeys- Keys to fetch immediately
getAllConfigsAsync()
Get all configurations asynchronously.options.properties- User properties for personalizationoptions.forceRefresh- Skip cache, fetch from API
fetchConfig()
Fetch configurations directly from API.options.immediateKeys- Keys to fetch immediatelyoptions.properties- User properties for personalizationoptions.userId- User ID override
configurations- Config key-value pairssnapshotId- Configuration snapshot IDqualifiedSegments- Matched user segmentsqualifiedRuleSets- Matched rule setsisFinal- Whether more configs may loadtimestamp- Response timestamp
preloadConfig()
Preload configurations for immediate synchronous access.immediateKeys- Specific keys to preload (optional, loads all if omitted)properties- User properties for personalization
- App startup
- Before rendering UI
- Critical configs needed immediately
addConfigChangeListener()
Add listener for configuration changes.listener- Callback function receiving updated configs
- After background refresh completes
- When manual refresh happens
- When cache updates
removeConfigChangeListener()
Remove configuration change listener.listener- Previously added listener function
- Component unmounts
- No longer need updates
- Cleanup on destroy
Configuration Flow
Cache-first strategy:getConfig()returns cached value (instant)- Background fetch starts automatically
- When fresh data arrives, listeners fire
- Cache updates for next access