-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (25 loc) · 686 Bytes
/
Copy pathscript.js
File metadata and controls
30 lines (25 loc) · 686 Bytes
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
var peer = new Peer({key: 'lwjd5qra8257b9'});
var db = firebase.firestore();
let id;
peer.on('open', function(id) {
console.log('My peer ID is: ' + id);
return id
var db = firebase.firestore();
db.collection("peerjs_ids").add({
db.collection("peerjs_ids").doc("id_n").set({
id: id
});
return id
});
console.log('HW');
var docRef = db.collection("peerjs_ids").doc("id_n");
docRef.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});