Skip to content

Commit dc4954f

Browse files
committed
Missing perf snippet
1 parent d5f652d commit dc4954f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

perf-next/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ const firebaseApp = initializeApp({
1010
});
1111
const perf = getInstance(firebaseApp);
1212

13+
function intialize() {
14+
// [START perf_initialize]
15+
const { initializeApp } = require("firebase/app");
16+
const { getPerformance } = require("firebase/performance");
17+
18+
// TODO: Replace the following with your app's Firebase project configuration
19+
// See: https://firebase.google.com/docs/web/setup#config-object
20+
const firebaseConfig = {
21+
// ...
22+
};
23+
24+
// Initialize Firebase
25+
const app = initializeApp(firebaseConfig);
26+
27+
// Initialize Performance Monitoring and get a reference to the service
28+
const perf = getPerformance(app);
29+
// [END perf_initialize]
30+
}
31+
1332
export function getInstance(firebaseApp) {
1433
// [START perf_get_instance]
1534
const { getPerformance } = require("firebase/performance");

perf/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ import "firebase/performance";
33

44
const perf = firebase.performance();
55

6+
function intialize() {
7+
// [START perf_initialize]
8+
// TODO: Replace the following with your app's Firebase project configuration
9+
// See: https://firebase.google.com/docs/web/setup#config-object
10+
var firebaseConfig = {
11+
// ...
12+
};
13+
14+
// Initialize Firebase
15+
firebase.initializeApp(firebaseConfig);
16+
17+
// Initialize Performance Monitoring and get a reference to the service
18+
var perf = firebase.performance();
19+
// [END perf_initialize]
20+
}
21+
622
function addCustomTrace() {
723
// [START perf_add_custom_trace]
824
const trace = perf.trace("CUSTOM_TRACE_NAME");

0 commit comments

Comments
 (0)