File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 33export async function onDocumentReady ( ) {
44
55 //[START rtdb_emulator_connect]
6- let firebaseConfig = {
7- // Point to the RTDB emulator running on localhost.
8- // Here we supply database namespace 'foo'.
9- databaseURL : "http://localhost:9000?ns=foo"
10- }
6+ if ( location . hostname === "localhost" ) {
117
12- var myApp = firebase . initializeApp ( firebaseConfig ) ;
13- const db = myApp . database ( ) ;
8+ var firebaseConfig = {
9+ // Point to the RTDB emulator running on localhost.
10+ // In almost all cases the ns (namespace) is your project ID.
11+ databaseURL : "http://localhost:9000?ns=YOUR_DATABASE_NAMESPACE"
12+ }
13+
14+ var myApp = firebase . initializeApp ( firebaseConfig ) ;
15+ var db = myApp . database ( ) ;
16+ }
1417 // [END rtdb_emulator_connect]
1518}
1619
17- export async function flushRealtimeDatabase ( anRTDBReference ) {
20+ export async function flushRealtimeDatabas ( firebase ) {
1821
1922 //[START rtdb_emulator_flush]
20- // With a database Reference, write null to the root node to delete the database.
21- anRTDBReference . child ( "/" ) . set ( null ) ;
23+ // With a database Reference, write null to clear the database.
24+ firebase . database ( ) . ref ( ) . set ( null ) ;
2225 // [END rtdb_emulator_connect]
2326}
You can’t perform that action at this time.
0 commit comments