Created
September 29, 2016 20:08
-
-
Save kulakowka/e961009580810f4c1ecbe93d676c9f9c to your computer and use it in GitHub Desktop.
promise serial
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
function runSerial (tasks) { | |
var result = Promise.resolve() | |
tasks.forEach(task => { | |
result = result.then(() => task()) | |
}) | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment