Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/remote-config-compat

Package Overview
Dependencies
Maintainers
4
Versions
1115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/remote-config-compat

The compatibility package of Remote Config

  • 0.2.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-29.23%
Maintainers
4
Weekly downloads
 
Created

What is @firebase/remote-config-compat?

@firebase/remote-config-compat is a Firebase package that allows developers to manage and fetch remote configuration parameters for their applications. This package is part of the Firebase suite and provides compatibility with older versions of Firebase Remote Config, making it easier to integrate with existing projects.

What are @firebase/remote-config-compat's main functionalities?

Fetch and Activate Remote Config

This feature allows you to fetch and activate remote configuration parameters from the Firebase server. The code initializes Firebase, sets up Remote Config with default settings, and fetches the latest configuration values.

const firebase = require('firebase/app');
require('firebase/remote-config');

firebase.initializeApp({
  apiKey: 'your-api-key',
  authDomain: 'your-auth-domain',
  projectId: 'your-project-id',
  storageBucket: 'your-storage-bucket',
  messagingSenderId: 'your-messaging-sender-id',
  appId: 'your-app-id'
});

const remoteConfig = firebase.remoteConfig();
remoteConfig.settings = {
  minimumFetchIntervalMillis: 3600000,
};

remoteConfig.defaultConfig = {
  'welcome_message': 'Welcome to my app!'
};

remoteConfig.fetchAndActivate()
  .then(() => {
    const welcomeMessage = remoteConfig.getString('welcome_message');
    console.log(welcomeMessage);
  })
  .catch((err) => {
    console.error('Error fetching remote config:', err);
  });

Get Remote Config Value

This feature allows you to retrieve a specific configuration value from the Remote Config. The code demonstrates how to get the value of 'welcome_message' after fetching and activating the remote configuration.

const firebase = require('firebase/app');
require('firebase/remote-config');

firebase.initializeApp({
  apiKey: 'your-api-key',
  authDomain: 'your-auth-domain',
  projectId: 'your-project-id',
  storageBucket: 'your-storage-bucket',
  messagingSenderId: 'your-messaging-sender-id',
  appId: 'your-app-id'
});

const remoteConfig = firebase.remoteConfig();
remoteConfig.settings = {
  minimumFetchIntervalMillis: 3600000,
};

remoteConfig.defaultConfig = {
  'welcome_message': 'Welcome to my app!'
};

remoteConfig.fetchAndActivate()
  .then(() => {
    const welcomeMessage = remoteConfig.getString('welcome_message');
    console.log(welcomeMessage);
  })
  .catch((err) => {
    console.error('Error fetching remote config:', err);
  });

Other packages similar to @firebase/remote-config-compat

FAQs

Package last updated on 14 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc