• firebase

firebase is a global namespace from which all Firebaseservices are accessed.

Index

Type aliases

EmulatorMockTokenOptions

EmulatorMockTokenOptions:{user_id:string } |{sub:string } &Partial<FirebaseIdToken>

FirebaseSignInProvider

FirebaseSignInProvider:"custom" |"email" |"password" |"phone" |"anonymous" |"google.com" |"facebook.com" |"github.com" |"twitter.com" |"microsoft.com" |"apple.com"

LogLevel

LogLevel:"debug" |"verbose" |"info" |"warn" |"error" |"silent"

The JS SDK supports 5 log levels and also allows a user the ability tosilence the logs altogether.

The order is as follows:silent < debug < verbose < info < warn < error

Variables

SDK_VERSION

SDK_VERSION:string

The current SDK version.

apps

apps:App[]

A (read-only) array of all initialized apps.

Functions

initializeApp

  • initializeApp(optionsObject, name?: string):App
  • Creates and initializes a Firebaseapp instance.

    See Add Firebase to your app and Initialize multiple projects for detailed documentation.

    example
    // Initialize default app// Retrieve your own options values by adding a web app on// https://console.firebase.google.comfirebase.initializeApp({apiKey:"AIza....",// Auth / General UseappId:"1:27992087142:web:ce....",// General UseprojectId:"my-firebase-project",// General UseauthDomain:"YOUR_APP.firebaseapp.com",// Auth with popup/redirectdatabaseURL:"https://YOUR_APP.firebaseio.com",// Realtime DatabasestorageBucket:"YOUR_APP.appspot.com",// StoragemessagingSenderId:"123456789",// Cloud MessagingmeasurementId:"G-12345"// Analytics});
    example
    // Initialize another appvar otherApp = firebase.initializeApp({apiKey:"AIza....",appId:"1:27992087142:web:ce....",projectId:"my-firebase-project",databaseURL:"https://<OTHER_DATABASE_NAME>.firebaseio.com",storageBucket:"<OTHER_STORAGE_BUCKET>.appspot.com"},"nameOfOtherApp");

    Parameters

    • options:Object

      Options to configure the app's services.

    • Optional name:string

      Optional name of the app to initialize. If no nameis provided, the default is"[DEFAULT]".

    ReturnsApp

    The initialized app.

onLog

  • onLog(logCallback(callbackParams{args:any[];level:LogLevel;message:string;type:string }) =>void, options?: {level:LogLevel }):void
  • Sets log handler for all Firebase packages.

    Parameters

    • logCallback:(callbackParams:{args:any[];level:LogLevel;message:string;type:string }) =>void

      An optional custom log handler that executes user code wheneverthe Firebase SDK makes a logging call.

        • (callbackParams:{args:any[];level:LogLevel;message:string;type:string }):void
        • Parameters

          • callbackParams:{args:any[];level:LogLevel;message:string;type:string }
            • args:any[]

              The raw arguments passed to the log call.

            • level:LogLevel

              Level of event logged.

            • message:string

              Any text from logged arguments joined into one string.

            • type:string

              A string indicating the name of the package that made the log call,such as@firebase/firestore.

          Returnsvoid

    • Optional options:{level:LogLevel }
      • level:LogLevel

        Threshhold log level. Only logs at or above this level trigger thelogCallbackpassed toonLog.

    Returnsvoid

registerVersion

  • registerVersion(librarystring, versionstring, variant?: string):void
  • Registers a library's name and version for platform logging purposes.

    Parameters

    • library:string

      Name of 1p or 3p library (e.g. firestore, angularfire)

    • version:string

      Current version of that library.

    • Optional variant:string

      Bundle variant, e.g., node, rn, etc.

    Returnsvoid

setLogLevel

  • setLogLevel(logLevelLogLevel):void
  • Sets log level for all Firebase packages.

    All of the log types above the current log level are captured (i.e. ifyou set the log level toinfo, errors are logged, butdebug andverbose logs are not).

    Parameters

    Returnsvoid

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-07-27 UTC.