The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Remote Config

Common use cases

Core

Initialization

import { getRemoteConfig } from "firebase/remote-config";

const remoteConfig = getRemoteConfig();

Set development mode for caching

remoteConfig.settings.minimumFetchIntervalMillis = 3600000;

Get active configuration and values

import { fetchAndActivate } from "firebase/remote-config";

fetchAndActivate(remoteConfig)
  .then(() => {
    // ...
  })
  .catch((err) => {
    // ...
  });

Get cached value

import { getValue } from "firebase/remote-config";

const val = getValue(remoteConfig, "welcome_messsage");

Set default values

remoteConfig.defaultConfig = {
  "welcome_message": "Welcome"
};