Skip to content

[perf] make initialize & get singleton lines more explicit for vNext #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions perf-next/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ function intialize() {

// [START perf_initialize_app]
// TODO: Replace the following with your app's Firebase project configuration
// See: https://firebase.google.com/docs/web/setup#config-object
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
// ...
};

// Initialize Firebase
initializeApp(firebaseConfig);
const app = initializeApp(firebaseConfig);
// [END perf_initialize_app]

// [START perf_singleton]
// Initialize Performance Monitoring and get a reference to the service
const perf = getPerformance();
const perf = getPerformance(app);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an intentional change, but it's fine either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davideast said that he preferred being more explicit with the demo snippet to ensure folks know how it's actually working, but then folks can do whatever they want in their actual code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 well a few months ago we removed this from all other snippets where possible:
#135

// [END perf_singleton]
}

Expand Down
2 changes: 1 addition & 1 deletion perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const perf = firebase.performance();
function intialize() {
// [START perf_initialize_app]
// TODO: Replace the following with your app's Firebase project configuration
// See: https://firebase.google.com/docs/web/setup#config-object
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
// ...
};
Expand Down
4 changes: 2 additions & 2 deletions snippets/perf-next/index/perf_initialize_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

// [START perf_initialize_app_modular]
// TODO: Replace the following with your app's Firebase project configuration
// See: https://firebase.google.com/docs/web/setup#config-object
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
// ...
};

// Initialize Firebase
initializeApp(firebaseConfig);
const app = initializeApp(firebaseConfig);
// [END perf_initialize_app_modular]
2 changes: 1 addition & 1 deletion snippets/perf-next/index/perf_singleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

// [START perf_singleton_modular]
// Initialize Performance Monitoring and get a reference to the service
const perf = getPerformance();
const perf = getPerformance(app);
// [END perf_singleton_modular]