“Periksa apakah firebase diinisialisasi” Kode Jawaban

Periksa apakah firebase diinisialisasi

// In v9, Firebase has been modularized for better tree shaking
import { initializeApp, getApps, getApp } from "firebase/app";
getApps().length === 0 ? initializeApp(firebaseConfig) : getApp();

// Web
if (firebase.apps.length === 0) {
    firebase.initializeApp({});
}

// Android
if (FirebaseApp.getApps(context).isEmpty()) {
    FirebaseApp.initializeApp(context);
}
// Instrumented Test Environment
InstrumentationRegistry.getContext()
RealMyth21

Periksa apakah firebase diinisialisasi

const { initializeApp, getApps, getApp, applicationDefault, cert } = require('firebase-admin/app');

const firebaseConfig = {
  credential: cert({
    type: process.env.FIREBASE_TYPE,
    project_id: process.env.FIREBASE_PROJECT_ID,
    private_key_id: process.env.FIREBASE_PRIVATE_KEY_ID,
    private_key: process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, '\n'),
    client_email: process.env.FIREBASE_CLIENT_EMAIL,
    client_id: process.env.FIREBASE_CLIENT_ID,
    auth_uri: process.env.FIREBASE_AUTH_URI,
    token_uri: process.env.FIREBASE_TOKEN_URI,
    auth_provider_x509_cert_url: process.env.FIREBASE_AUTH_PROVIDER,
    client_x509_cert_url: process.env.FIREBASE_CLIENT_CERT
  })
}

getApps().length === 0 ? initializeApp(firebaseConfig) : getApp();
Bruno Ferreira

Jawaban yang mirip dengan “Periksa apakah firebase diinisialisasi”

Pertanyaan yang mirip dengan “Periksa apakah firebase diinisialisasi”

Lebih banyak jawaban terkait untuk “Periksa apakah firebase diinisialisasi” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya