-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
33 lines (31 loc) · 1.14 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// TODO(DEVELOPER): Change the values below using values from the initialization snippet: Firebase Console > Overview > Add Firebase to your web app.
// Initialize Firebase
var config = {
apiKey: "<YOUR_API_KEY>",
databaseURL: "<YOUR_DATABASE_URL>",
storageBucket: "<YOUR_STORAGE_BUCKET_NAME>"
};
firebase.initializeApp(config);
/**
* initApp handles setting up the Firebase context and registering
* callbacks for the auth status.
*
* The core initialization is in firebase.App - this is the glue class
* which stores configuration. We provide an app name here to allow
* distinguishing multiple app instances.
*
* This method also registers a listener with firebase.auth().onAuthStateChanged.
* This listener is called when the user is signed in or out, and that
* is where we update the UI.
*
* When signed in, we also authenticate to the Firebase Realtime Database.
*/
function initApp() {
// Listen for auth state changes.
firebase.auth().onAuthStateChanged(function(user) {
console.log('User state change detected from the Background script of the Chrome Extension:', user);
});
}
window.onload = function() {
initApp();
};