Skip to content

Commit d01cdd5

Browse files
authored
Add FirebaseApp vNext Snippets (#94)
1 parent 64cc018 commit d01cdd5

File tree

5 files changed

+70
-0
lines changed

5 files changed

+70
-0
lines changed

firebaseapp-next/firebaseapp.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// [SNIPPET_REGISTRY disabled]
2+
// [SNIPPETS_SEPARATION enabled]
3+
4+
function multpleFirebaseApps() {
5+
// [START firebase_options]
6+
const { initializeApp } = require("firebase/app");
7+
8+
// The following fields are REQUIRED:
9+
// - Project ID
10+
// - App ID
11+
// - API Key
12+
const secondaryAppConfig = {
13+
projectId: "<PROJECT_ID>",
14+
appId: "<APP_ID>",
15+
apiKey: "<API_KEY>",
16+
// databaseURL: "...",
17+
// storageBucket: "...",
18+
};
19+
// [END firebase_options]
20+
21+
// [START firebase_secondary]
22+
// Initialize another app with a different config
23+
const secondaryApp = initializeApp(secondaryAppConfig, "secondary");
24+
// Access services, such as the Realtime Database
25+
// getDatabase(secondaryApp)
26+
// [END firebase_secondary]
27+
}

firebaseapp-next/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "firebaseapp-next",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"compile": "cp ../tsconfig.json.template ./tsconfig.json && tsc"
6+
},
7+
"license": "Apache-2.0",
8+
"dependencies": {
9+
"firebase": "exp"
10+
}
11+
}

lerna.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"database",
99
"database-next",
1010
"firebaseapp",
11+
"firebaseapp-next",
1112
"firestore",
1213
"firestore-next",
1314
"functions",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firebaseapp-next/firebaseapp.js
3+
//
4+
// To make edits to the snippets in this file, please edit the source
5+
6+
// [START firebase_options_modular]
7+
import { initializeApp } from "firebase/app";
8+
9+
// The following fields are REQUIRED:
10+
// - Project ID
11+
// - App ID
12+
// - API Key
13+
const secondaryAppConfig = {
14+
projectId: "<PROJECT_ID>",
15+
appId: "<APP_ID>",
16+
apiKey: "<API_KEY>",
17+
// databaseURL: "...",
18+
// storageBucket: "...",
19+
};
20+
// [END firebase_options_modular]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./firebaseapp-next/firebaseapp.js
3+
//
4+
// To make edits to the snippets in this file, please edit the source
5+
6+
// [START firebase_secondary_modular]
7+
// Initialize another app with a different config
8+
const secondaryApp = initializeApp(secondaryAppConfig, "secondary");
9+
// Access services, such as the Realtime Database
10+
// getDatabase(secondaryApp)
11+
// [END firebase_secondary_modular]

0 commit comments

Comments
 (0)