{"id":1829,"date":"2022-04-29T14:52:29","date_gmt":"2022-04-29T05:52:29","guid":{"rendered":"http:\/\/www.agile-software.site\/?p=1829"},"modified":"2022-07-16T16:31:08","modified_gmt":"2022-07-16T07:31:08","slug":"async-await","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=1829","title":{"rendered":"async\/await"},"content":{"rendered":"\n<p>Promise\u3092\u4f7f\u3063\u305f\u975e\u540c\u671f\u51e6\u7406\u3092\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<br>\u975e\u540c\u671f\u51e6\u7406\u306f\u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\u306e\u7d50\u679c\u3092\u5f85\u305f\u305a\u306b\u3059\u3050\u6b21\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u308b\u4ed5\u7d44\u307f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Promise\u306e\u72b6\u614b<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>apending<\/strong>\uff1a \u521d\u671f\u72b6\u614b\u3001\u5b9f\u884c\u4e2d\u3002\u6210\u529f\u3082\u5931\u6557\u3082\u3057\u3066\u3044\u306a\u3044<\/li><li><strong>fulfilled<\/strong>\uff1a \u51e6\u7406\u304c\u5b8c\u4e86\u3057\u305f\u72b6\u614b\u3002then \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059<\/li><li><strong>rejected<\/strong>\uff1a \u51e6\u7406\u304c\u5931\u6557\u3057\u305f\u72b6\u614b\u3002then \u30e1\u30bd\u30c3\u30c9\u3068 catch \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Promise\u306ethen<\/h2>\n\n\n\n<p>Promise \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u72b6\u614b\u304c\u00a0<code><strong>fulfilled<\/strong><\/code>\u00a0\u3068\u306a\u3063\u305f\u3068\u304d\u306b\u5b9f\u884c\u3059\u308b\u95a2\u6570\u3092\u767b\u9332\u3067\u304d\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Promise\u306ecatch<\/h2>\n\n\n\n<p>\u00a0Promise \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u72b6\u614b\u304c\u00a0<code><strong>rejected<\/strong><\/code>\u00a0\u3068\u306a\u3063\u305f\u3068\u304d\u306b\u5b9f\u884c\u3059\u308b\u95a2\u6570\u3092\u767b\u9332\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">async\u3068\u306f<\/h2>\n\n\n\n<p><br>async\u306ffunction\u306e\u524d\u306b\u8a18\u8ff0\u3059\u308b\u3060\u3051\u3067\u975e\u540c\u671f\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u308b\u95a2\u6570\u3092\u5b9a\u7fa9\u3067\u304d\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>async function(){}<\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u95a2\u6570\u306fPromise\u3092\u8fd4\u3059\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">await\u3068\u306f<\/h2>\n\n\n\n<p>await\u306fPromise\u51e6\u7406\u306e\u7d50\u679c\u304c\u8fd4\u3063\u3066\u304f\u308b\u307e\u3067\u4e00\u6642\u505c\u6b62\u3057\u3066\u304f\u308c\u308b\u6f14\u7b97\u5b50<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>await Promise\u51e6\u7406<\/code><\/pre><\/div>\n\n\n\n<p>await\u306fasync\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u95a2\u6570\u306e\u4e2d\u3060\u3051\u3067\u3057\u304b\u4f7f\u3048\u306a\u3044<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Promise\u3092\u4f7f\u3063\u305f\u975e\u540c\u671f\u51e6\u7406\u3092\u7c21\u6f54\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u975e\u540c\u671f\u51e6\u7406\u306f\u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\u306e\u7d50\u679c\u3092\u5f85\u305f\u305a\u306b\u3059\u3050\u6b21\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u308b\u4ed5\u7d44\u307f\u3002 Promise\u306e\u72b6\u614b apending\uff1a \u521d\u671f\u72b6\u614b\u3001\u5b9f\u884c\u4e2d\u3002\u6210\u529f\u3082\u5931\u6557\u3082\u3057\u3066\u3044\u306a<\/p>\n","protected":false},"author":1,"featured_media":2028,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1829","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/1829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1829"}],"version-history":[{"count":2,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/1829\/revisions"}],"predecessor-version":[{"id":2026,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/1829\/revisions\/2026"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/media\/2028"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}