Stay organized with collections
Save and categorize content based on your preferences.
Type aliases
EventType
EventType: "value" | "child_added" | "child_changed" | "child_moved" | "child_removed"
Functions
enableLogging
- enableLogging
(
logger
?
:
boolean
|
(
(
a
:
string
)
=>
any
)
,
persistent
?
:
boolean
)
:
any
-
Parameters
-
Optional logger: boolean | ((a: string) => any)
-
Optional persistent: boolean
Returns any
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-09-28 UTC.
[null,null,["Last updated 2023-09-28 UTC."],[],[],null,["- [firebase](/docs/reference/js/v8/firebase).\n- database \n\nCallable\n\n- database ( app ? : [App](/docs/reference/js/v8/firebase.app.App) ) : [Database](/docs/reference/js/v8/firebase.database.Database)\n- Gets the [`Database`](/docs/reference/js/v8/firebase.database.Database) service for the\n default app or a given app.\n\n `firebase.database()` can be called with no arguments to access the default\n app's [`Database`](/docs/reference/js/v8/firebase.database.Database) service or as\n `firebase.database(app)` to access the\n [`Database`](/docs/reference/js/v8/firebase.database.Database) service associated with a\n specific app.\n\n `firebase.database` is also a namespace that can be used to access global\n constants and methods associated with the `Database` service.\n\n example\n :\n\n // Get the Database service for the default app\n var defaultDatabase = firebase.database();\n\n\n example\n :\n\n // Get the Database service for a specific app\n var otherDatabase = firebase.database(app);\n\n\n namespace\n :\n\n Parameters\n -\n\n Optional app: [App](/docs/reference/js/v8/firebase.app.App) \n Optional app whose Database service to\n return. If not provided, the default Database service will be returned.\n\n Returns [Database](/docs/reference/js/v8/firebase.database.Database)\n\n The default Database service if no app\n is provided or the Database service associated with the provided app.\n\nIndex\n\nModules\n\n- [ServerValue](/docs/reference/js/v8/firebase.database.ServerValue)\n\nInterfaces\n\n- [DataSnapshot](/docs/reference/js/v8/firebase.database.DataSnapshot)\n- [Database](/docs/reference/js/v8/firebase.database.Database)\n- [IteratedDataSnapshot](/docs/reference/js/v8/firebase.database.iterateddatasnapshot)\n- [OnDisconnect](/docs/reference/js/v8/firebase.database.OnDisconnect)\n- [Query](/docs/reference/js/v8/firebase.database.Query)\n- [Reference](/docs/reference/js/v8/firebase.database.Reference)\n- [ThenableReference](/docs/reference/js/v8/firebase.database.ThenableReference)\n- [TransactionResult](/docs/reference/js/v8/firebase.database.TransactionResult)\n\nType aliases\n\n- [EmulatorMockTokenOptions](/docs/reference/js/v8/firebase.database#emulatormocktokenoptions)\n- [EventType](/docs/reference/js/v8/firebase.database#eventtype)\n\nFunctions\n\n- [enableLogging](/docs/reference/js/v8/firebase.database#enablelogging)\n\nType aliases\n\nEmulatorMockTokenOptions \nEmulatorMockTokenOptions: [EmulatorMockTokenOptions](/docs/reference/js/v8/firebase#emulatormocktokenoptions)\n\nEventType \nEventType: \"value\" \\| \"child_added\" \\| \"child_changed\" \\| \"child_moved\" \\| \"child_removed\"\n\nFunctions\n\nenableLogging\n\n- enableLogging ( logger ? : boolean \\| ( ( a : string ) =\\\u003e any ) , persistent ? : boolean ) : any\n- Logs debugging information to the console.\n\n example\n :\n\n // Enable logging\n firebase.database.enableLogging(true);\n\n\n example\n :\n\n // Disable logging\n firebase.database.enableLogging(false);\n\n\n example\n :\n\n // Enable logging across page refreshes\n firebase.database.enableLogging(true, true);\n\n\n example\n :\n\n // Provide custom logger which prefixes log statements with \"[FIREBASE]\"\n firebase.database.enableLogging(function(message) {\n console.log(\"[FIREBASE]\", message);\n });\n\n\n Parameters\n -\n\n Optional logger: boolean \\| ((a: string) =\\\u003e any) \n Enables logging if `true`;\n disables logging if `false`. You can also provide a custom logger function\n to control how things get logged.\n -\n\n Optional persistent: boolean \n Remembers the logging state between page\n refreshes if `true`.\n\nReturns any"]]
Gets the
Database
service for the default app or a given app.firebase.database()
can be called with no arguments to access the default app'sDatabase
service or asfirebase.database(app)
to access theDatabase
service associated with a specific app.firebase.database
is also a namespace that can be used to access global constants and methods associated with theDatabase
service.// Get the Database service for the default app var defaultDatabase = firebase.database();
// Get the Database service for a specific app var otherDatabase = firebase.database(app);