Last active
October 11, 2017 14:53
-
-
Save zlatkov/f94c8e16cbbb8b8940744b348c70de14 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 delay(time) { | |
return new Promise(function(resolve, reject){ | |
setTimeout(resolve, time); | |
}); | |
} | |
delay(1000) | |
.then(function(){ | |
console.log("after 1000ms"); | |
return delay(2000); | |
}) | |
.then(function(){ | |
console.log("after another 2000ms"); | |
}) | |
.then(function(){ | |
console.log("step 4 (next Job)"); | |
return delay(5000); | |
}) | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment