@firebase/remote-config
- Version 0.5.0
- Published
- 396 kB
- 5 dependencies
- Apache-2.0 license
Install
npm i @firebase/remote-config
yarn add @firebase/remote-config
pnpm add @firebase/remote-config
Overview
The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environment.
Index
Functions
Interfaces
Type Aliases
Functions
function activate
activate: (remoteConfig: RemoteConfig) => Promise<boolean>;
Makes the last fetched config available to the getters.
Parameter remoteConfig
The RemoteConfig instance.
Returns
A
Promise
which resolves to true if the current call activated the fetched configs. If the fetched configs were already activated, thePromise
will resolve to false.Modifiers
@public
function ensureInitialized
ensureInitialized: (remoteConfig: RemoteConfig) => Promise<void>;
Ensures the last activated config are available to the getters.
Parameter remoteConfig
The RemoteConfig instance.
Returns
A
Promise
that resolves when the last activated config is available to the getters.Modifiers
@public
function fetchAndActivate
fetchAndActivate: (remoteConfig: RemoteConfig) => Promise<boolean>;
Performs fetch and activate operations, as a convenience.
Parameter remoteConfig
The RemoteConfig instance.
Returns
A
Promise
which resolves to true if the current call activated the fetched configs. If the fetched configs were already activated, thePromise
will resolve to false.Modifiers
@public
function fetchConfig
fetchConfig: (remoteConfig: RemoteConfig) => Promise<void>;
Fetches and caches configuration from the Remote Config service.
Parameter remoteConfig
The RemoteConfig instance.
Modifiers
@public
function getAll
getAll: (remoteConfig: RemoteConfig) => Record<string, Value>;
function getBoolean
getBoolean: (remoteConfig: RemoteConfig, key: string) => boolean;
Gets the value for the given key as a boolean.
Convenience method for calling remoteConfig.getValue(key).asBoolean().
Parameter remoteConfig
The RemoteConfig instance.
Parameter key
The name of the parameter.
Returns
The value for the given key as a boolean.
Modifiers
@public
function getNumber
getNumber: (remoteConfig: RemoteConfig, key: string) => number;
Gets the value for the given key as a number.
Convenience method for calling remoteConfig.getValue(key).asNumber().
Parameter remoteConfig
The RemoteConfig instance.
Parameter key
The name of the parameter.
Returns
The value for the given key as a number.
Modifiers
@public
function getRemoteConfig
getRemoteConfig: (app?: FirebaseApp) => RemoteConfig;
function getString
getString: (remoteConfig: RemoteConfig, key: string) => string;
Gets the value for the given key as a string. Convenience method for calling remoteConfig.getValue(key).asString().
Parameter remoteConfig
The RemoteConfig instance.
Parameter key
The name of the parameter.
Returns
The value for the given key as a string.
Modifiers
@public
function getValue
getValue: (remoteConfig: RemoteConfig, key: string) => Value;
Gets the Value for the given key.
Parameter remoteConfig
The RemoteConfig instance.
Parameter key
The name of the parameter.
Returns
The value for the given key.
Modifiers
@public
function isSupported
isSupported: () => Promise<boolean>;
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.Returns
A
Promise
which resolves to true if a RemoteConfig instance can be initialized in this environment, or false if it cannot.Modifiers
@public
function setCustomSignals
setCustomSignals: ( remoteConfig: RemoteConfig, customSignals: CustomSignals) => Promise<void>;
Sets the custom signals for the app instance.
Parameter remoteConfig
The RemoteConfig instance.
Parameter customSignals
Map (key, value) of the custom signals to be set for the app instance. If a key already exists, the value is overwritten. Setting the value of a custom signal to null unsets the signal. The signals will be persisted locally on the client.
Modifiers
@public
function setLogLevel
setLogLevel: (remoteConfig: RemoteConfig, logLevel: LogLevel) => void;
Defines the log level to use.
Parameter remoteConfig
The RemoteConfig instance.
Parameter logLevel
The log level to set.
Modifiers
@public
Interfaces
interface CustomSignals
interface CustomSignals {}
Defines the type for representing custom signals and their values.
The values in CustomSignals must be one of the following types:
string number null
Modifiers
@public
index signature
[key: string]: string | number | null;
interface RemoteConfig
interface RemoteConfig {}
The Firebase Remote Config service interface.
Modifiers
@public
property app
app: FirebaseApp;
The @firebase/app#FirebaseApp this
RemoteConfig
instance is associated with.
property defaultConfig
defaultConfig: { [key: string]: string | number | boolean;};
Object containing default values for configs.
property fetchTimeMillis
fetchTimeMillis: number;
The Unix timestamp in milliseconds of the last successful fetch, or negative one if the RemoteConfig instance either hasn't fetched or initialization is incomplete.
property lastFetchStatus
lastFetchStatus: FetchStatus;
The status of the last fetch attempt.
property settings
settings: RemoteConfigSettings;
Defines configuration for the Remote Config SDK.
interface RemoteConfigSettings
interface RemoteConfigSettings {}
Defines configuration options for the Remote Config SDK.
Modifiers
@public
property fetchTimeoutMillis
fetchTimeoutMillis: number;
Defines the maximum amount of milliseconds to wait for a response when fetching configuration from the Remote Config server. Defaults to 60000 (One minute).
property minimumFetchIntervalMillis
minimumFetchIntervalMillis: number;
Defines the maximum age in milliseconds of an entry in the config cache before it is considered stale. Defaults to 43200000 (Twelve hours).
interface Value
interface Value {}
Wraps a value with metadata and type-safe getters.
Modifiers
@public
method asBoolean
asBoolean: () => boolean;
Gets the value as a boolean.
The following values (case-insensitive) are interpreted as true: "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
method asNumber
asNumber: () => number;
Gets the value as a number. Comparable to calling Number(value) || 0.
method asString
asString: () => string;
Gets the value as a string.
method getSource
getSource: () => ValueSource;
Gets the ValueSource for the given key.
Type Aliases
type FetchStatus
type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
"no-fetch-yet" indicates the RemoteConfig 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.
Modifiers
@public
type LogLevel
type LogLevel = 'debug' | 'error' | 'silent';
Defines levels of Remote Config logging.
Modifiers
@public
type ValueSource
type ValueSource = 'static' | 'default' | 'remote';
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.
Modifiers
@public
Package Files (1)
Dependencies (5)
Dev Dependencies (4)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/remote-config
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/remote-config)
- HTML<a href="https://www.jsdocs.io/package/@firebase/remote-config"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4237 ms. - Missing or incorrect documentation? Open an issue for this package.