Created
November 10, 2016 07:53
-
-
Save dstyle0210/ee54fa2268b6d4693a1ac99fa86e72fe to your computer and use it in GitHub Desktop.
[es6] promise 기본 사용법
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(){ | |
| 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