Skip to content

Commit 1207a53

Browse files
committed
Types and changeset
1 parent 285c55d commit 1207a53

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.changeset/bright-ducks-jump.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
2+
'firebase': minor
23
'@firebase/database': minor
4+
'@firebase/database-types': minor
35
---
46

5-
Add a useEmulator(host, port) method
7+
Add a useEmulator(host, port) method to Realtime Database

packages/database-types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface DataSnapshot {
3434

3535
export interface Database {
3636
app: FirebaseApp;
37+
useEmulator(host: string, port: number): void;
3738
goOffline(): void;
3839
goOnline(): void;
3940
ref(path?: string | Reference): Reference;
@@ -43,6 +44,7 @@ export interface Database {
4344
export class FirebaseDatabase implements Database {
4445
private constructor();
4546
app: FirebaseApp;
47+
useEmulator(host: string, port: number): void;
4648
goOffline(): void;
4749
goOnline(): void;
4850
ref(path?: string | Reference): Reference;

packages/database/src/api/Database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class Database implements FirebaseService {
103103
* @param host the emulator host (ex: localhost)
104104
* @param port the emulator port (ex: 8080)
105105
*/
106-
useEmulator(host: string, port: number) {
106+
useEmulator(host: string, port: number): void {
107107
if (this.instanceUsed_) {
108108
fatal(
109109
'Cannot call useEmulator() after instance has already been initialized.'

packages/firebase/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5647,6 +5647,15 @@ declare namespace firebase.database {
56475647
* ```
56485648
*/
56495649
app: firebase.app.App;
5650+
/**
5651+
* Modify this instance to communicate with the Realtime Database emulator.
5652+
*
5653+
* <p>Note: this must be called before this instance has been used to do any operations.
5654+
*
5655+
* @param host the emulator host (ex: localhost)
5656+
* @param port the emulator port (ex: 8080)
5657+
*/
5658+
useEmulator(host: string, port: number): void;
56505659
/**
56515660
* Disconnects from the server (all Database operations will be completed
56525661
* offline).

0 commit comments

Comments
 (0)