Last active
December 24, 2022 21:58
-
-
Save feliperohdee/2875973886da506ad454c15790d7eea5 to your computer and use it in GitHub Desktop.
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
const putData = async (data, ms) => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(data); | |
}, ms); | |
}); | |
}; | |
const [ | |
result1, | |
result2, | |
result3 | |
] = await Promise.all([ | |
putData({ | |
foo: 'bar-1' | |
}, 1000), | |
putData({ | |
foo: 'bar-2' | |
}, 2000), | |
putData({ | |
foo: 'bar-3' | |
}, 3000) | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment