Created
June 3, 2018 05:27
-
-
Save yongjun823/f2ef3c690c223ea3a7a21ffaa028afcc to your computer and use it in GitHub Desktop.
async await promise all test
This file contains hidden or 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
| 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