Skip to content

Commit 9fcfc64

Browse files
authored
Initialize functions snippet (firebase#205)
1 parent 9d1c8c5 commit 9fcfc64

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

functions-next/callable.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
// [SNIPPET_REGISTRY disabled]
22
// [SNIPPETS_SEPARATION enabled]
33

4+
export function initialize() {
5+
// [START fb_functions_initialize]
6+
const { initializeApp } = require("firebase/app");
7+
const { getFunctions } = require("firebase/functions");
8+
9+
initializeApp({
10+
// Your Firebase Web SDK configuration
11+
// [START_EXCLUDE]
12+
projectId: "<PROJECT_ID>",
13+
apiKey: "<API_KEY>",
14+
// [END_EXCLUDE]
15+
});
16+
17+
const functions = getFunctions();
18+
// [END fb_functions_initialize]
19+
}
20+
421
export function callAddMessage() {
522
const messageText = "Hello, World!";
623

functions/callable.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
// [START fb_functions_imports]
12
import firebase from "firebase/app";
23
import "firebase/functions";
4+
// [END fb_functions_imports]
5+
6+
function initialize() {
7+
// [START fb_functions_initialize]
8+
firebase.initializeApp({
9+
// Your Firebase Web SDK configuration
10+
// [START_EXCLUDE]
11+
projectId: "<PROJECT_ID>",
12+
apiKey: "<API_KEY>",
13+
// [END_EXCLUDE]
14+
});
15+
16+
const functions = firebase.functions();
17+
// [END fb_functions_initialize]
18+
}
319

420
function callAddMessage() {
521
const messageText = "Hello, World!";
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This snippet file was generated by processing the source file:
2+
// ./functions-next/callable.js
3+
//
4+
// To make edits to the snippets in this file, please edit the source
5+
6+
// [START fb_functions_initialize_modular]
7+
import { initializeApp } from "firebase/app";
8+
import { getFunctions } from "firebase/functions";
9+
10+
initializeApp({
11+
// Your Firebase Web SDK configuration
12+
// [START_EXCLUDE]
13+
projectId: "<PROJECT_ID>",
14+
apiKey: "<API_KEY>",
15+
// [END_EXCLUDE]
16+
});
17+
18+
const functions = getFunctions();
19+
// [END fb_functions_initialize_modular]

0 commit comments

Comments
 (0)