• 追加された行はこの色です。
  • 削除された行はこの色です。
#author("2019-10-09T09:24:07+09:00","default:ryuichi","ryuichi")
#author("2019-10-09T09:29:52+09:00","default:ryuichi","ryuichi")
* Promiseの実行 [#m1a1b5e7]

** 呼び出される非同期関数 [#f273c339]

 function resolveAfter3Seconds() {
   return new Promise(resolve => {
     setTimeout(() => {
       resolve('resolved');
     }, 3000);
   });
 }
 


** 非同期関数の呼び出し 1 - Promise.then() [#wf9516e4]

 resolveAfter3Seconds().then((data) =>{
     console.log(data);
 });


** 非同期関数の呼び出し 2 - async/await [#xe4d9364]


 async function getAsyncData() {
     const result = await resolveAfter3Seconds();
     console.log(result);
 }
 
 getAsyncData();



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS