Skip to content

Instantly share code, notes, and snippets.

@feliperohdee
Last active December 24, 2022 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliperohdee/2875973886da506ad454c15790d7eea5 to your computer and use it in GitHub Desktop.
Save feliperohdee/2875973886da506ad454c15790d7eea5 to your computer and use it in GitHub Desktop.
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