Skip to content

Instantly share code, notes, and snippets.

@zlatkov
Last active October 11, 2017 14:53
Show Gist options
  • Save zlatkov/f94c8e16cbbb8b8940744b348c70de14 to your computer and use it in GitHub Desktop.
Save zlatkov/f94c8e16cbbb8b8940744b348c70de14 to your computer and use it in GitHub Desktop.
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