-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
49 lines (43 loc) · 1.55 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// TODO(DEVELOPER): Change the values below using values from the initialization snippet: Firebase Console > Overview > Add Firebase to your web app.
// Initialize Firebase
// Initialize Firebase
var config = {
apiKey: "AIzaSyA6dqc5N8_RuG4bMIr1qoj4HxgmxQnCspQ",
authDomain: "copycliper.firebaseapp.com",
databaseURL: "https://copycliper.firebaseio.com",
projectId: "copycliper",
storageBucket: "copycliper.appspot.com",
messagingSenderId: "84458212725"
};
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);
});
}
function writeUserData(userId, title,message, time) {
document.getElementById('quickstart-account-details').textContent = time;
firebase.database().ref(uid).push().set({
title: title,
message: message,
time : time
});
}
window.onload = function() {
initApp();
};