Skip to content

Instantly share code, notes, and snippets.

@choru-k
Last active November 19, 2016 06:08
Show Gist options
  • Save choru-k/bbc08b8f217d50e72e4873dab056ed3f to your computer and use it in GitHub Desktop.
Save choru-k/bbc08b8f217d50e72e4873dab056ed3f to your computer and use it in GitHub Desktop.
promise chain test 1
var _promise1 = function (param) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve("ok1");
}, 3000);
});
};
var _promise2 = function (param) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve("ok2");
}, 3000);
});
};
_promise1(true)
.then(function (text) {
_promise2(true)
.then(function (text) {
console.log(text);
})
console.log(text);
}).then(function() {
console.log('ok3')
});
// result
// ok1 - 3second later
// ok3 - 3second later
// ok2 - 6second later
@voidsatisfaction
Copy link

여기서 then뒤에는 아에 return 이 없잖아

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment