- firebase.
- database
Callable
- database(app?: App):Database
Gets the
Databaseservice for thedefault app or a given app.firebase.database()can be called with no arguments to access the defaultapp'sDatabaseservice or asfirebase.database(app)to access theDatabaseservice associated with aspecific app.firebase.databaseis also a namespace that can be used to access globalconstants and methods associated with theDatabaseservice.- example
// Get the Database service for the default appvar defaultDatabase = firebase.database();- example
// Get the Database service for a specific appvar otherDatabase = firebase.database(app);- namespace
Parameters
Optional app:App
Optional app whose Database service toreturn. If not provided, the default Database service will be returned.
ReturnsDatabase
The default Database service if no appis provided or the Database service associated with the provided app.
Index
Type aliases
EmulatorMockTokenOptions
EventType
Functions
enableLogging
- enable
Logging(logger?: boolean |((a: string) =>any), persistent?: boolean):any Logs debugging information to the console.
- example
// Enable loggingfirebase.database.enableLogging(true);- example
// Disable loggingfirebase.database.enableLogging(false);- example
// Enable logging across page refreshesfirebase.database.enableLogging(true,true);- example
// Provide custom logger which prefixes log statements with "[FIREBASE]"firebase.database.enableLogging(function(message){console.log("[FIREBASE]", message);});
Parameters
Optional logger:boolean |((a:string) =>any)
Enables logging if
true;disables logging iffalse. You can also provide a custom logger functionto control how things get logged.Optional persistent:boolean
Remembers the logging state between pagerefreshes if
true.
Returnsany
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 2023-09-28 UTC.