ES2017ã§ä»æ§ã«å ¥ã£ãAsyncFunctionã¨awaitåé æ¼ç®åã ãããã使ãã¨éåæå¦çãåæçã«æ¸ããã¨ãã§ããéåæå¦çã®ã«ã¼ããã·ã³ãã«ã«æ¸ããããã«ãªãã ãã®è¨äºã®å 容ã¯å ¨ã¦Node.jsã®v8.6.0ã§åä½ç¢ºèªãã¦ããã éåæå¦çã®åºç¤ã¯ãã¡ãã AsyncFunction é¢æ°å®ç¾©ã®åã«asyncã¨ã¤ããã¨ããã®é¢æ°ã¯AsyncFunctionã«ãªãã async function myFunc(){ return 'foo'; } console.log(myFunc); // [AsyncFunction: myFunc] console.log(myFunc()); // Promise { 'foo' } myFunc().then(res => console.log(res)); // foo éåæå¦çãã·ã³ãã«ã«æ¸ãã¦ãããã¨ãåããã Asy
{{#tags}}- {{label}}
{{/tags}}