Skip to main content

getConfig()

Get configuration value synchronously from cache or defaults.
Parameters:
  • key - Configuration key
Returns: Configuration value or undefined Example:
Behavior:
  • Returns cached value instantly
  • Returns default if provided
  • Returns undefined if not found
  • Triggers background refresh

getAllConfigs()

Get all configurations synchronously.
Returns: Object with all configuration key-value pairs Example:

getConfigAsync()

Get configuration value asynchronously with cache-first strategy.
Parameters:
  • key - Configuration key
  • options.properties - User properties for personalization
  • options.forceRefresh - Skip cache, fetch from API
  • options.immediateKeys - Keys to fetch immediately
Returns: Promise resolving to configuration value Example:

getAllConfigsAsync()

Get all configurations asynchronously.
Parameters:
  • options.properties - User properties for personalization
  • options.forceRefresh - Skip cache, fetch from API
Returns: Promise resolving to all configurations Example:

fetchConfig()

Fetch configurations directly from API.
Parameters:
  • options.immediateKeys - Keys to fetch immediately
  • options.properties - User properties for personalization
  • options.userId - User ID override
Returns: Promise resolving to full API response Example:
Response includes:
  • configurations - Config key-value pairs
  • snapshotId - Configuration snapshot ID
  • qualifiedSegments - Matched user segments
  • qualifiedRuleSets - Matched rule sets
  • isFinal - Whether more configs may load
  • timestamp - Response timestamp

preloadConfig()

Preload configurations for immediate synchronous access.
Parameters:
  • immediateKeys - Specific keys to preload (optional, loads all if omitted)
  • properties - User properties for personalization
Returns: Promise that resolves when configs are loaded Example:
When to use:
  • App startup
  • Before rendering UI
  • Critical configs needed immediately

addConfigChangeListener()

Add listener for configuration changes.
Parameters:
  • listener - Callback function receiving updated configs
Example:
When listeners fire:
  • After background refresh completes
  • When manual refresh happens
  • When cache updates

removeConfigChangeListener()

Remove configuration change listener.
Parameters:
  • listener - Previously added listener function
Example:
When to remove:
  • Component unmounts
  • No longer need updates
  • Cleanup on destroy

Configuration Flow

Cache-first strategy:
  1. getConfig() returns cached value (instant)
  2. Background fetch starts automatically
  3. When fresh data arrives, listeners fire
  4. Cache updates for next access
Personalization: Pass properties to get user-specific values:
Rules in dashboard determine which values match which users.

Next Steps

Remote Config

Learn configuration concepts

Core Methods

Event tracking methods