Skip to content

Instantly share code, notes, and snippets.

@ginpei
Created June 10, 2013 02:14
Show Gist options
  • Save ginpei/5746126 to your computer and use it in GitHub Desktop.
Save ginpei/5746126 to your computer and use it in GitHub Desktop.
function's chaining
// (start) -> Any jobs... -> "OK 1" -> Any jobs... -> "OK 3" -> Any jobs... -> "OK 3"
Promise(function(resolve) {
console.log('OK 1');
setTimeout(resolve, 1000);
}).then(function() {
Promise(function(resolve) {
console.log('OK 2');
setTimeout(resolve, 1000);
}).then(function() {
console.log('OK 3');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment