Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- write data1
- write data2
- write data3
- ... after some delay
- response for data1
- response for data2
- response for data3
- async function sendData(data) {
- await streamObj.data()
- }
- console.log('reponse1', await sendData('data1'));
- console.log('reponse2', await sendData('data2'));
- console.log('reponse3', await sendData('data3'));
- console.log(await Promise.all(sendData('data1'), sendData('data2'), sendData('data3')));
- // should logs: [ 'response1', 'response2', 'response3' ]
Add Comment
Please, Sign In to add comment