Created
July 28, 2016 06:27
-
-
Save ahy4/7e36ea167a55c93f6cb7ab78495fdc25 to your computer and use it in GitHub Desktop.
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
| // http://gao-tec.seesaa.net/article/427643074.html | |
| async function Main(){ | |
| //実行時即表示 | |
| console.log("a"); | |
| //このawaitで2秒間待機してくれる(風に見せかけることが出来る) | |
| await new Promise((resolve)=>{ | |
| setTimeout(resolve,2000); | |
| }); | |
| //2秒後に表示 | |
| console.log("b"); | |
| //このawaitで1秒間待機してくれる(風に見せかけることが出来る) | |
| await new Promise((resolve)=>{ | |
| setTimeout(resolve,1000); | |
| }); | |
| //1秒後(実行から合計3秒後)に表示 | |
| console.log("c"); | |
| } | |
| Main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment