Skip to content

Instantly share code, notes, and snippets.

@yongjun823
Created June 3, 2018 05:27
Show Gist options
  • Select an option

  • Save yongjun823/f2ef3c690c223ea3a7a21ffaa028afcc to your computer and use it in GitHub Desktop.

Select an option

Save yongjun823/f2ef3c690c223ea3a7a21ffaa028afcc to your computer and use it in GitHub Desktop.
async await promise all test
function Firebase1() {
return new Promise(resolve => {
db.collection("ReceivedTransferFinAccount").get().then((querySnapshot) => {
const data = []
querySnapshot.forEach((doc) => {
data.push(doc.data())
});
resolve(data)
});
});
}
function Firebase2() {
return new Promise(resolve => {
db.collection("DrawingTransfer").get().then((querySnapshot) => {
const data = []
querySnapshot.forEach((doc) => {
data.push(doc.data())
});
resolve(data)
});
});
}
async function fb() {
console.time('fb');
// const data1 = await Firebase1();
// const data2 = await Firebase2();
// console.timeEnd('fb');
Promise.all([Firebase1(), Firebase2()]).then(v => {
console.timeEnd('fb');
})
}
fb();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment