Created
February 8, 2020 10:23
-
-
Save antronic/38a53f1f0dccc6451d8e72414e0a8135 to your computer and use it in GitHub Desktop.
JSBKK - seek code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Meow~</title> | |
</head> | |
<body> | |
Hello JSBKK | |
</body> | |
<script type="text/javascript" src="./bower_components/firebase/firebase.js"></script> | |
<script> | |
const firebaseConfig = { | |
apiKey: 'AIzaSyCDBqjN2IOo-sycp9ITPgSNpc_KBPtjTYg', | |
authDomain: 'javascriptbangkok-companion.firebaseapp.com', | |
databaseURL: 'https://javascriptbangkok-companion.firebaseio.com', | |
projectId: 'javascriptbangkok-companion', | |
storageBucket: 'javascriptbangkok-companion.appspot.com', | |
messagingSenderId: '838146383473', | |
appId: '1:838146383473:web:91601ee661d34794a085d0', | |
measurementId: 'G-FPZZTTK06Y' | |
}; | |
firebase.initializeApp(firebaseConfig); | |
function getEnvName() { | |
const match = String(window.location.search).match(/[&?]env=(\w+)/); | |
if (match) { | |
const [, env] = match; | |
sessionStorage.JS_BANGKOK_BACKEND_ENV = env; | |
return env; | |
} | |
return sessionStorage.JS_BANGKOK_BACKEND_ENV || 'production'; | |
} | |
function getEnvRef() { | |
const env = getEnvName(); | |
return firebase.database().ref(`environments/production`); | |
} | |
console.log(getEnvRef()) | |
function getUsers() { | |
// const nn = getEnvRef() | |
// .child('networking') | |
// .child('winner') | |
const nn = | |
firebase.firestore() | |
.collection('environments') | |
.doc(getEnvName()) | |
// .child('') | |
// .child('announcement') | |
//"Welcome to JavaScript Bangkok 1.0.0 Companion Site!<p>For those who request for transportation reimbursement (Scholarship Ticket). Please visit to Accounting Booth at 18:00 onwards for reimburse</p>" | |
// .child('networking') | |
// .child('winner') | |
console.log(nn) | |
nn.once('value').then((cb) => { | |
console.log('value') | |
console.log(cb.val()); | |
}) | |
// nn.update({ 'text': '<strong>Hello from the other side~</strong>' }) | |
} | |
getUsers() | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment