-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.js
57 lines (42 loc) · 1.36 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
50
51
52
53
54
55
56
57
import "./firebase-app.js"
import "./firebase-firestore.js"
var firebaseConfig = {
apiKey: "AIzaSyAcW4vasvdqRAAIDuZ_AI4UQFsDRIt25D4",
authDomain: "assignmentscheduler-615db.firebaseapp.com",
databaseURL: "https://assignmentscheduler-615db.firebaseio.com",
projectId: "assignmentscheduler-615db",
storageBucket: "assignmentscheduler-615db.appspot.com",
messagingSenderId: "97409100334",
appId: "1:97409100334:web:0772cbe879c2f775e00dbf"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
var firestore = firebase.firestore();
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(request);
firestore.collection("Upcoming tasks").add({
category: "Test",
course: sender.tab.url,
date: new Date()
})
})
/*const form = document.querySelector('add-task-form');
form.addEventListener('submit', (e) => {
e.preventDefault();
firestore.collection("Upcoming tasks").add({
category: form.category.value,
course: form.course.value,
date: new Date()
})
})*/
// receive message from content.js then send it to database
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(request);
firestore.collection("Upcoming tasks").add({
category: "Test",
course: sender.tab.url,
date: new Date()
})
})