Functions

Function Description
getDatabase(app) Gets the service for the default app or a given app.getDatabase() can be called with no arguments to access the default app's service or as getDatabase(app) to access the service associated with a specific app.
getDatabaseWithUrl(url, app) Gets the service for the default app or a given app.getDatabaseWithUrl() can be called with no arguments to access the default app's service or as getDatabaseWithUrl(app) to access the service associated with a specific app.

Interfaces

Interface Description
Database

Variables

Variable Description
enableLogging [enableLogging](https://firebase.google.com/docs/reference/js/firebase.database#enablelogging) function from the @firebase/database package.
ServerValue [ServerValue](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) module from the @firebase/database package.

getDatabase()

Gets the service for the default app or a given app.

getDatabase() can be called with no arguments to access the default app's service or as getDatabase(app) to access the service associated with a specific app.

Signature:

export declare function getDatabase(app?: App): Database;

Parameters

Parameter Type Description
app App

Returns:

Database

Example 1

// Get the Database service for the default app
const defaultDatabase = getDatabase();

Example 2

// Get the Database service for a specific app
const otherDatabase = getDatabase(app);

getDatabaseWithUrl()

Gets the service for the default app or a given app.

getDatabaseWithUrl() can be called with no arguments to access the default app's service or as getDatabaseWithUrl(app) to access the service associated with a specific app.

Signature:

export declare function getDatabaseWithUrl(url: string, app?: App): Database;

Parameters

Parameter Type Description
url string
app App

Returns:

Database

Example 1

// Get the Database service for the default app
const defaultDatabase = getDatabaseWithUrl('https://example.firebaseio.com');

Example 2

// Get the Database service for a specific app
const otherDatabase = getDatabaseWithUrl('https://example.firebaseio.com', app);

enableLogging

[enableLogging](https://firebase.google.com/docs/reference/js/firebase.database#enablelogging) function from the @firebase/database package.

Signature:

enableLogging: typeof rtdb.enableLogging

ServerValue

[ServerValue](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) module from the @firebase/database package.

Signature:

ServerValue: rtdb.ServerValue