Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
Created November 10, 2016 07:53
Show Gist options
  • Select an option

  • Save dstyle0210/ee54fa2268b6d4693a1ac99fa86e72fe to your computer and use it in GitHub Desktop.

Select an option

Save dstyle0210/ee54fa2268b6d4693a1ac99fa86e72fe to your computer and use it in GitHub Desktop.
[es6] promise 기본 사용법
$(function(){
var promise1 = new Promise(function (resolve, reject) {
$.getJSON("ajax경로1",function(result) {
// 해결됨
console.log("첫번째 Promise 완료");
resolve(result);
});
});
var promise2 = new Promise(function (resolve, reject) {
$.getJSON("ajax경로2",function(result) {
console.log("두번째 Promise 완료");
resolve(result);
});
});
Promise.all([promise1, promise2]).then(function (values) {
console.log("모두 완료됨", values);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment