@@ -35,13 +35,78 @@ export {
3535 ThenableReference ,
3636} from '@firebase/database-types' ;
3737
38+ /**
39+ * [`enableLogging`](https://firebase.google.com/docs/reference/js/firebase.database#enablelogging)
40+ * function from the `@firebase/database` package.
41+ */
3842export const enableLogging : typeof rtdb . enableLogging = enableLoggingFunc ;
43+
44+ /**
45+ * [`ServerValue`](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue)
46+ * module from the `@firebase/database` package.
47+ */
3948export const ServerValue : rtdb . ServerValue = serverValueConst ;
4049
50+ /**
51+ * Gets the {@link database.Database `Database`} service for the default
52+ * app or a given app.
53+ *
54+ * `getDatabase()` can be called with no arguments to access the default
55+ * app's {@link database.Database `Database`} service or as
56+ * `getDatabase(app)` to access the
57+ * {@link database.Database `Database`} service associated with a specific
58+ * app.
59+ *
60+ * @example
61+ * ```javascript
62+ * // Get the Database service for the default app
63+ * const defaultDatabase = getDatabase();
64+ * ```
65+ *
66+ * @example
67+ * ```javascript
68+ * // Get the Database service for a specific app
69+ * const otherDatabase = getDatabase(app);
70+ * ```
71+ *
72+ * @param App whose `Database` service to
73+ * return. If not provided, the default `Database` service will be returned.
74+ *
75+ * @return The default `Database` service if no app
76+ * is provided or the `Database` service associated with the provided app.
77+ */
4178export function getDatabase ( app ?: App ) : Database {
4279 return getDatabaseInstance ( { app } ) ;
4380}
4481
82+ /**
83+ * Gets the {@link database.Database `Database`} service for the default
84+ * app or a given app.
85+ *
86+ * `getDatabaseWithUrl()` can be called with no arguments to access the default
87+ * app's {@link database.Database `Database`} service or as
88+ * `getDatabaseWithUrl(app)` to access the
89+ * {@link database.Database `Database`} service associated with a specific
90+ * app.
91+ *
92+ * @example
93+ * ```javascript
94+ * // Get the Database service for the default app
95+ * const defaultDatabase = getDatabaseWithUrl('https://example.firebaseio.com');
96+ * ```
97+ *
98+ * @example
99+ * ```javascript
100+ * // Get the Database service for a specific app
101+ * const otherDatabase = getDatabaseWithUrl('https://example.firebaseio.com', app);
102+ * ```
103+ *
104+ * @param App whose `Database` service to
105+ * return. If not provided, the default `Database` service will be returned.
106+ *
107+ * @return The default `Database` service if no app
108+ * is provided or the `Database` service associated with the provided app.
109+ */
45110export function getDatabaseWithUrl ( url : string , app ?: App ) : Database {
46111 return getDatabaseInstance ( { url, app } ) ;
47112}
0 commit comments