Skip to content

Instantly share code, notes, and snippets.

Sandro Padin spadin

Block or report user

Report or block spadin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@spadin
spadin / sequential-promises.js
Created Jan 31, 2019
Run promises sequentially using Array#reduce
View sequential-promises.js
// https://css-tricks.com/why-using-reduce-to-sequentially-resolve-promises-works/
const sayHelloIn = (seconds) => () => new Promise((resolve, reject) => {
setTimeout(() => {
console.log(`Hello ${seconds} seconds later.`)
resolve();
}, seconds * 1000);
});
const sequentially = async (fns) => {
You can’t perform that action at this time.