{"id":5526,"date":"2022-07-05T18:12:18","date_gmt":"2022-07-05T10:12:18","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=5526"},"modified":"2022-07-20T10:31:34","modified_gmt":"2022-07-20T02:31:34","slug":"%e6%95%99%e7%a8%8bizasyncinvoker-%e5%bc%82%e6%ad%a5%e7%bc%96%e7%a8%8b%e4%b9%8b%e4%b8%89%ef%bc%9a%e6%88%91%e4%bb%ac%e5%af%b9%e5%bc%82%e6%ad%a5%e7%bc%96%e7%a8%8b%e7%9a%84%e4%b8%80%e4%ba%9b%e8%a7%82","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5526","title":{"rendered":"[\u6559\u7a0b]ZAsync \u5f02\u6b65\u7f16\u7a0b\u4e4b\u4e09\uff1a\u6211\u4eec\u5bf9\u5f02\u6b65\u7f16\u7a0b\u7684\u4e00\u4e9b\u89c2\u70b9"},"content":{"rendered":"\n<p>\u5f02\u6b65\u7f16\u7a0b\u5bf9\u4e8e\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u53c8\u7231\u53c8\u6068\u7684\u4e1c\u897f\uff0c\u7528\u597d\u4e86\u5f88\u8212\u670d\uff0c\u7528\u4e0d\u597d\u5f88\u9ebb\u70e6\u3002\u5f02\u6b65\u7f16\u7a0b\u4e2d\uff0c\u5f02\u6b65\u64cd\u4f5c\u4ee3\u7801\u7684\u672c\u8eab\u662f\u5728\u4e00\u4e2a\u540e\u53f0\u7ebf\u7a0b\u6216\u5f53\u524d\u7ebf\u7a0b\u4e2d\u5ef6\u8fdf\u8c03\u7528\u3002\u800c\u5927\u5bb6\u8bf4\u5f02\u6b65\u7f16\u7a0b\u7684\u51e0\u79cd\u4e0d\u540c\u7684\u5904\u7406\u65b9\u5f0f\uff0c\u5b9e\u9645\u4e0a\u662f\u6307\u5bf9\u5f02\u6b65\u5904\u7406\u5b8c\u6210\u540e\uff0c\u5982\u4f55\u5904\u7406\u540e\u7eed\u7684\u6b65\u9aa4\uff0c\u672c\u8d28\u4e0a\u90fd\u662f\u56de\u8c03\u5904\u7406\u51fd\u6570\uff0c\u4f46\u64cd\u4f5c\u5404\u6709\u4e0d\u540c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u76f4\u63a5\u8bbe\u7f6e\u56de\u8c03\u51fd\u6570<\/li><li>\u8ba2\u9605\u673a\u5236\uff1a\u8ba2\u9605\u5f02\u6b65\u4f5c\u4e1a\u901a\u77e5\uff0c\u672c\u8d28\u4e0a\u8fd8\u662f\u56de\u8c03\u51fd\u6570\uff0c\u53ea\u662f\u7531\u4e00\u4e2a\u6539\u4e3a\u591a\u4e2a\uff0c\u5404\u79cd\u6240\u8c13\u7684 observers \u5f52\u4e8e\u6b64\u7c7b<\/li><li>\u94fe\u5f0f\u8c03\u7528\uff1ado(something).then(dosomething1) \u8fd9\u79cd\u6a21\u5f0f\uff0c\u5b9e\u9645\u4e0a\u8fd8\u662f\u56de\u8c03\u7684\u8bed\u6cd5\u7cd6<\/li><li>\u4e8b\u4ef6\u54cd\u5e94\uff1a\u4e8b\u4ef6\u54cd\u5e94\u51fd\u6570\u672c\u8eab\u5c31\u662f\u4e00\u4e2a\u56de\u8c03\uff0c\u540c\u6837\u5f52\u5230\u6b64\u7c7b<\/li><li>async\/await\uff1a\u9ad8\u7ea7\u7cd6\u679c\uff0c\u5fc5\u9700\u627f\u8ba4\uff0c\u8fd9\u79cd\u673a\u5236\u7684\u4f18\u52bf\u5728\u4e8e\u539f\u7ebf\u7a0b\u539f\u8bed\u4e49\uff0c\u4ee3\u7801\u7684\u6267\u884c\u5728\u539f\u6765\u7684\u7ebf\u7a0b\u7a7a\u95f2\u65f6\u95f4\u7247\u6267\u884c\u3002\u5b83\u8ffd\u6c42\u7684\u4e0d\u662f\u5e76\u53d1\uff0c\u800c\u662f\u5145\u5206\u5229\u7528\u7ebf\u7a0b\u7684\u7a7a\u95f2\u8d44\u6e90\u3002async\/await \u7684\u5b9e\u73b0\uff0c\u56e0\u4e3a\u8981\u5728\u539f\u7ebf\u7a0b\u6267\u884c\uff0c\u6240\u4ee5\u5c31\u8981\u6c42\u539f\u6765\u7684\u7ebf\u7a0b\u4e0d\u80fd\u6b7b\u6389\uff0c\u5426\u5219\u80af\u5b9a\u5207\u4e0d\u56de\u53bb\u3002\u800c\u4e14\u539f\u6765\u7684\u7ebf\u7a0b\u8981\u56de\u8c03\u5bf9\u5e94\u7684\u4ee3\u7801\u6267\u884c\uff0c\u5fc5\u9700\u5207\u6362\u5230\u4e00\u79cd\u7279\u6b8a\u7684\u72b6\u6001\uff0c\u65b9\u5f0f\u4e0d\u5916\u4e4e\u4e09\u79cd\uff1a\u534f\u7a0b\u3001\u7ea4\u7a0b\u548c APC \u65b9\u5f0f\uff0c\u5b9e\u9645\u4e0a\u8fd9\u4e09\u79cd\u65b9\u5f0f\u6ca1\u6709\u5565\u672c\u8d28\u7684\u533a\u522b\uff0c\u90fd\u662f\u7ebf\u7a0b\u8fdb\u5165\u7a7a\u95f2\u65f6\uff0c\u8c03\u7528\u76f8\u5e94\u7684\u5904\u7406\u4ee3\u7801\u3002\u5f53\u5bf9\u5e94\u7684\u4ee3\u7801\u6267\u884c\u5b8c\u6216\u8fdb\u5165\u7b49\u5f85\u72b6\u6001\u65f6\uff0c\u53bb\u8c03\u7528\u4e0b\u4e00\u4e2a\u5904\u7406\u4ee3\u7801\u3002\u672c\u8d28\u4e0a\uff0c\u4ecd\u662f\u8bb0\u5f55\u5404\u4e2a\u5904\u7406\u51fd\u6570\u4ee3\u7801\u7684\u4f4d\u7f6e\uff0c\u7136\u540e\u8c03\u7528\u539f\u6765\u7684\u51fd\u6570\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8ba4\u4e3a\u5b83\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u56de\u8c03\u3002<\/li><\/ul>\n\n\n\n<p>\u5bf9\u4e8e ZAsync \u6765\u8bf4\uff0c\u6211\u4eec\u5173\u6ce8\u7684\u662f\u5f02\u6b65\u7f16\u7a0b\u672c\u8eab\uff0c\u800c\u4e0d\u662f\u600e\u4e48\u901a\u77e5\u7ed3\u679c\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5f02\u6b65\u64cd\u4f5c\u8981\u5728\u4e3b\u7ebf\u7a0b\u8fd8\u662f\u5728\u540e\u53f0\u7ebf\u7a0b\u4e2d\u6267\u884c\uff1f<\/li><li>\u5f02\u6b65\u64cd\u4f5c\u662f\u5426\u9700\u8981\u5ef6\u8fdf\u6267\u884c\uff1f<\/li><li>\u591a\u4e2a\u5f02\u6b65\u64cd\u4f5c\u4e4b\u95f4\u662f\u4ec0\u4e48\u5173\u7cfb\uff1f\u5e76\u53d1\u8fd8\u662f\u4e32\u884c\uff1f<\/li><li>\u600e\u4e48\u4fdd\u8bc1\u5f02\u6b65\u7f16\u7a0b\u4e2d\u8d44\u6e90\u7684\u6709\u6548\u6027\uff1f<\/li><li>\u662f\u5426\u6709\u5fc5\u8981\u5728\u5f53\u524d\u7ebf\u7a0b\u4e2d\u5ef6\u8fdf\u8c03\u7528\u5bf9\u5e94\u7684\u5f02\u6b65\u64cd\u4f5c\uff1f\u4e8b\u5b9e\u4e0a\uff0c\u5982\u679c\u91c7\u7528 async \u6a21\u5f0f\uff0c\u51e0\u4e4e\u5fc5\u7136\u80fd\u652f\u6301 await \u6a21\u5f0f\uff0c\u53ea\u662f\u6211\u4eec\u662f\u5426\u6709\u5fc5\u8981\u652f\u6301\uff1f<\/li><\/ul>\n\n\n\n<p>ZAsync \u5c06\u8bd5\u56fe\u4e00\u4e00\u89e3\u7b54\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n\n\n\n<p><strong>[\u6ce8\u610f]<\/strong><\/p>\n\n\n\n<p>1\u3001\u4e0d\u8981\u56e0\u4e3a async \u6a21\u5f0f\u662f\u5728\u5f53\u524d\u7ebf\u7a0b\u4e2d\u6267\u884c\uff0c\u4e0d\u9700\u8981\u8fdb\u884c\u9501\u800c\u6389\u4ee5\u8f7b\u5fc3\u3002\u5728\u6709\u591a\u4e2a\u5f02\u6b65\u5bf9\u4e0a\u4e00\u7ea7\u4f5c\u7528\u57df\u7684\u53d8\u91cf\u7684\u8bbf\u95ee\u65f6\uff0c\u5c24\u5176\u6ce8\u610f\u3002\u5f53\u4e00\u4e2a\u5f02\u6b65\u4f5c\u4e1a\u7684\u4ee3\u7801\u4ea4\u51fa\u63a7\u5236\u6743\u540e\uff0c\u53e6\u4e00\u4e2a\u53ef\u80fd\u4f1a\u6539\u53d8\u4e0a\u7ea7\u4f5c\u7528\u57df\u53d8\u91cf\u7684\u503c\uff0c\u5e94\u5c3d\u91cf\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n\n\n\n<p>2\u3001async\/await \u4f9d\u8d56\u4e8e\u5f53\u524d\u7ebf\u7a0b\u7684\u5b58\u5728\uff0c\u5982\u679c\u5f53\u524d\u7ebf\u7a0b\u5f02\u5e38\u4e2d\u6b62\u9000\u51fa\uff0c\u5219\u4f1a\u9020\u6210\u540e\u7eed\u7684\u4ee3\u7801\u6ca1\u6cd5\u6b63\u5e38\u6267\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f02\u6b65\u7f16\u7a0b\u5bf9\u4e8e\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u53c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[],"class_list":["post-5526","post","type-post","status-publish","format-standard","hentry","category-delphi"],"views":1641,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5526"}],"version-history":[{"count":5,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5526\/revisions"}],"predecessor-version":[{"id":5560,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5526\/revisions\/5560"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}