Created
March 12, 2017 06:12
-
-
Save uangsl/7ad05c6fc6822d6796398c648540b9f9 to your computer and use it in GitHub Desktop.
javascript 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
| new Promise(function(resolve, reject){ | |
| setTimeout(function(){ | |
| console.log("resolve", 1); | |
| resolve("result"); | |
| }, 2000); | |
| }).then(function(v){ | |
| return new Promise(function(resolve, reject) { | |
| console.log("then", 2); | |
| setTimeout(function(){ | |
| console.log("then", 3); | |
| //resolve(v); | |
| }, 2000); | |
| }); | |
| }).then(function(v){ | |
| console.log("then then", 4); | |
| console.log("then then", v); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment