The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environment.
Functions
Function | Description |
---|---|
function(app, ...) | |
getRemoteConfig(app) | |
function(remoteConfig, ...) | |
activate(remoteConfig) | Makes the last fetched config available to the getters. |
ensureInitialized(remoteConfig) | Ensures the last activated config are available to the getters. |
fetchAndActivate(remoteConfig) | Performs fetch and activate operations, as a convenience. |
fetchConfig(remoteConfig) | Fetches and caches configuration from the Remote Config service. |
getAll(remoteConfig) | Gets all config. |
getBoolean(remoteConfig, key) | Gets the value for the given key as a boolean.Convenience method for calling remoteConfig.getValue(key).asBoolean() . |
getNumber(remoteConfig, key) | Gets the value for the given key as a number.Convenience method for calling remoteConfig.getValue(key).asNumber() . |
getString(remoteConfig, key) | Gets the value for the given key as a string. Convenience method for calling remoteConfig.getValue(key).asString() . |
getValue(remoteConfig, key) | Gets the Value for the given key. |
setLogLevel(remoteConfig, logLevel) | Defines the log level to use. |
function() | |
isSupported() | This method provides two different checks:1. Check if IndexedDB exists in the browser environment. 2. Check if the current browser context allows IndexedDB open() calls. |
Interfaces
Interface | Description |
---|---|
RemoteConfig | The Firebase Remote Config service interface. |
RemoteConfigSettings | Defines configuration options for the Remote Config SDK. |
Value | Wraps a value with metadata and type-safe getters. |
Type Aliases
Type Alias | Description |
---|---|
FetchStatus | Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
|
LogLevel | Defines levels of Remote Config logging. |
ValueSource | Indicates the source of a value.
|
function(app, ...)
getRemoteConfig(app)
Signature:
export declare function getRemoteConfig(app?: FirebaseApp): RemoteConfig;
Parameters
Parameter | Type | Description |
---|---|---|
app | FirebaseApp | The FirebaseApp instance. |
Returns:
A RemoteConfig instance.
function(remoteConfig, ...)
activate(remoteConfig)
Makes the last fetched config available to the getters.
Signature:
export declare function activate(remoteConfig: RemoteConfig): Promise<boolean>;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
Returns:
Promise<boolean>
A Promise
which resolves to true if the current call activated the fetched configs. If the fetched configs were already activated, the Promise
will resolve to false.
ensureInitialized(remoteConfig)
Ensures the last activated config are available to the getters.
Signature:
export declare function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
Returns:
Promise<void>
A Promise
that resolves when the last activated config is available to the getters.
fetchAndActivate(remoteConfig)
Performs fetch and activate operations, as a convenience.
Signature:
export declare function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
Returns:
Promise<boolean>
A Promise
which resolves to true if the current call activated the fetched configs. If the fetched configs were already activated, the Promise
will resolve to false.
fetchConfig(remoteConfig)
Fetches and caches configuration from the Remote Config service.
Signature:
export declare function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
Returns:
Promise<void>
getAll(remoteConfig)
Gets all config.
Signature:
export declare function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
Returns:
Record<string, Value>
All config.
getBoolean(remoteConfig, key)
Gets the value for the given key as a boolean.
Convenience method for calling remoteConfig.getValue(key).asBoolean()
.
Signature:
export declare function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
key | string | The name of the parameter. |
Returns:
boolean
The value for the given key as a boolean.
getNumber(remoteConfig, key)
Gets the value for the given key as a number.
Convenience method for calling remoteConfig.getValue(key).asNumber()
.
Signature:
export declare function getNumber(remoteConfig: RemoteConfig, key: string): number;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
key | string | The name of the parameter. |
Returns:
number
The value for the given key as a number.
getString(remoteConfig, key)
Gets the value for the given key as a string. Convenience method for calling remoteConfig.getValue(key).asString()
.
Signature:
export declare function getString(remoteConfig: RemoteConfig, key: string): string;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
key | string | The name of the parameter. |
Returns:
string
The value for the given key as a string.
getValue(remoteConfig, key)
Gets the Value for the given key.
Signature:
export declare function getValue(remoteConfig: RemoteConfig, key: string): Value;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
key | string | The name of the parameter. |
Returns:
The value for the given key.
setLogLevel(remoteConfig, logLevel)
Defines the log level to use.
Signature:
export declare function setLogLevel(remoteConfig: RemoteConfig, logLevel: RemoteConfigLogLevel): void;
Parameters
Parameter | Type | Description |
---|---|---|
remoteConfig | RemoteConfig | The RemoteConfig instance. |
logLevel | RemoteConfigLogLevel | The log level to set. |
Returns:
void
function()
isSupported()
This method provides two different checks:
- Check if IndexedDB exists in the browser environment. 2. Check if the current browser context allows IndexedDB
open()
calls.
Signature:
export declare function isSupported(): Promise<boolean>;
Returns:
Promise<boolean>
A Promise
which resolves to true if a RemoteConfig instance can be initialized in this environment, or false if it cannot.
FetchStatus
Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
- "no-fetch-yet" indicates the [RemoteConfig](./remote-config.remoteconfig.md#remoteconfig_interface) instance has not yet attempted to fetch config, or that SDK initialization is incomplete.
- "success" indicates the last attempt succeeded.
- "failure" indicates the last attempt failed.
- "throttle" indicates the last attempt was rate-limited.
Signature:
export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
LogLevel
Defines levels of Remote Config logging.
Signature:
export type LogLevel = 'debug' | 'error' | 'silent';
ValueSource
Indicates the source of a value.
- "static" indicates the value was defined by a static constant.
- "default" indicates the value was defined by default config.
- "remote" indicates the value was defined by fetched config.
Signature:
export type ValueSource = 'static' | 'default' | 'remote';