{"id":62144,"date":"2026-01-19T12:49:44","date_gmt":"2026-01-19T04:49:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/62144.html"},"modified":"2026-01-19T12:49:44","modified_gmt":"2026-01-19T04:49:44","slug":"%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3-javascript-%e5%bc%82%e6%ad%a5%e7%bc%96%e7%a8%8b%ef%bc%9a%e4%bb%8e-event-loop-%e5%88%b0-promise","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/62144.html","title":{"rendered":"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise"},"content":{"rendered":"<p><span style=\"color:#be191c\">\u4e2a\u4eba\u7a7a\u95f4&#xff1a;<\/span><span class=\"link-card-box\"><span class=\"link-title\">https:\/\/blog.csdn.net\/m0_73589512<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260119044943-696db7e72902b.png\" \/>https:\/\/blog.csdn.net\/m0_73589512<\/span><\/span><\/p>\n<p>\u5927\u5bb6\u597d&#xff0c;\u6211\u662f<span style=\"color:#1c7892\">\u53c1\u4f70\u4e07~~<\/span><\/p>\n<p>\u5982\u679c\u672c\u6587\u5bf9\u60a8\u6709\u5e2e\u52a9&#xff0c;\u8bf7\u732e\u4e0a\u4f60\u7684<span style=\"color:#be191c\">\u5c0f\u2765(^_-)\u54df~~~<\/span><\/p>\n<p>\u4f5c\u4e3a\u524d\u7aef\u5f00\u53d1\u8005&#xff0c;\u6211\u4eec\u6bcf\u5929\u90fd\u5728\u548c JavaScript \u7684\u5f02\u6b65\u7279\u6027\u6253\u4ea4\u9053 \u2014\u2014 \u5b9a\u65f6\u5668\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u4e8b\u4ef6\u56de\u8c03\u2026\u2026 \u4f46\u4f60\u771f\u7684\u7406\u89e3 JS \u5355\u7ebf\u7a0b\u4e0b\u7684\u5f02\u6b65\u5e95\u5c42\u903b\u8f91\u5417&#xff1f;\u672c\u6587\u5c06\u4ece\u8fdb\u7a0b\u7ebf\u7a0b\u57fa\u7840\u8bb2\u8d77&#xff0c;\u4e00\u6b65\u6b65\u62c6\u89e3 Event Loop\u3001\u5b8f\u5fae\u4efb\u52a1\u3001Promise \u6838\u5fc3\u539f\u7406&#xff0c;\u5e2e\u4f60\u5f7b\u5e95\u641e\u61c2 JS \u5f02\u6b65\u7f16\u7a0b\u3002<\/p>\n<p>\u63a5\u7eed\u4e0a\u6587&#xff1a;<span class=\"link-card-box\"><span class=\"link-title\">https:\/\/blog.csdn.net\/m0_73589512\/article\/details\/157133111<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260119044943-696db7e72902b.png\" \/>https:\/\/blog.csdn.net\/m0_73589512\/article\/details\/157133111<\/span><\/span><\/p>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E5%9F%BA%E7%A1%80%E8%AE%A4%E7%9F%A5%EF%BC%9A%E8%BF%9B%E7%A8%8B%E4%B8%8E%E7%BA%BF%E7%A8%8B-toc\" style=\"margin-left:40px\">\u4e00\u3001\u57fa\u7840\u8ba4\u77e5&#xff1a;\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E6%A0%B8%E5%BF%83%E6%9C%BA%E5%88%B6%EF%BC%9AEvent%20Loop%EF%BC%88%E4%BA%8B%E4%BB%B6%E5%BE%AA%E7%8E%AF%EF%BC%89-toc\" style=\"margin-left:40px\">\u4e8c\u3001\u6838\u5fc3\u673a\u5236&#xff1a;Event Loop&#xff08;\u4e8b\u4ef6\u5faa\u73af&#xff09;<\/p>\n<p id=\"2.1%20%E5%90%8C%E6%AD%A5%E4%B8%8E%E5%BC%82%E6%AD%A5%E7%9A%84%E6%9C%AC%E8%B4%A8-toc\" style=\"margin-left:80px\">2.1 \u540c\u6b65\u4e0e\u5f02\u6b65\u7684\u672c\u8d28<\/p>\n<p id=\"2.2%20%E5%AE%8F%E4%BB%BB%E5%8A%A1%E4%B8%8E%E5%BE%AE%E4%BB%BB%E5%8A%A1-toc\" style=\"margin-left:80px\">2.2 \u5b8f\u4efb\u52a1\u4e0e\u5fae\u4efb\u52a1<\/p>\n<p id=\"Event%20Loop%20%E5%AE%8C%E6%95%B4%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B-toc\" style=\"margin-left:120px\">Event Loop \u5b8c\u6574\u6267\u884c\u6d41\u7a0b<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E5%BC%82%E6%AD%A5%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%9APromise-toc\" style=\"margin-left:40px\">\u4e09\u3001\u5f02\u6b65\u89e3\u51b3\u65b9\u6848&#xff1a;Promise<\/p>\n<p id=\"3.1%20Promise%20%E6%A0%B8%E5%BF%83%E7%89%B9%E6%80%A7-toc\" style=\"margin-left:80px\">3.1 Promise \u6838\u5fc3\u7279\u6027<\/p>\n<p id=\"3.2%20Promise%20%E5%B8%B8%E7%94%A8%E9%9D%99%E6%80%81%E6%96%B9%E6%B3%95-toc\" style=\"margin-left:80px\">3.2 Promise \u5e38\u7528\u9759\u6001\u65b9\u6cd5<\/p>\n<p id=\"3.3%20%E6%89%8B%E5%86%99%20Promise%EF%BC%88%E6%A0%B8%E5%BF%83%E5%AE%9E%E7%8E%B0%EF%BC%89-toc\" style=\"margin-left:80px\">3.3 \u624b\u5199 Promise&#xff08;\u6838\u5fc3\u5b9e\u73b0&#xff09;<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E8%AF%AD%E6%B3%95%E7%B3%96%EF%BC%9Aasync%2Fawait-toc\" style=\"margin-left:40px\">\u56db\u3001\u8bed\u6cd5\u7cd6&#xff1a;async\/await<\/p>\n<p id=\"%E6%A0%B8%E5%BF%83%E7%89%B9%E7%82%B9-toc\" style=\"margin-left:80px\">\u6838\u5fc3\u7279\u70b9<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E6%80%BB%E7%BB%93-toc\" style=\"margin-left:40px\">\u4e94\u3001\u603b\u7ed3<\/p>\n<hr id=\"hr-toc\" \/>\n<h3 id=\"%E4%B8%80%E3%80%81%E5%9F%BA%E7%A1%80%E8%AE%A4%E7%9F%A5%EF%BC%9A%E8%BF%9B%E7%A8%8B%E4%B8%8E%E7%BA%BF%E7%A8%8B\">\u4e00\u3001\u57fa\u7840\u8ba4\u77e5&#xff1a;\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b<\/h3>\n<p>\u8981\u7406\u89e3 JS \u5f02\u6b65&#xff0c;\u9996\u5148\u5f97\u641e\u6e05\u695a\u300c\u8fdb\u7a0b\u300d\u548c\u300c\u7ebf\u7a0b\u300d\u8fd9\u4e24\u4e2a\u57fa\u7840\u6982\u5ff5&#xff0c;\u8fd9\u662f\u6d4f\u89c8\u5668\u5b9e\u73b0\u5f02\u6b65\u7684\u786c\u4ef6\u5e95\u5c42\u652f\u6491\u3002<\/p>\n<table>\n<tr>\u5bf9\u6bd4\u7ef4\u5ea6\u8fdb\u7a0b\u7ebf\u7a0b<\/tr>\n<tbody>\n<tr>\n<td>\u901a\u4fd7\u7c7b\u6bd4<\/td>\n<td>\u5de5\u5382\u91cc\u7684\u72ec\u7acb\u8f66\u95f4<\/td>\n<td>\u8f66\u95f4\u91cc\u7684\u5de5\u4eba<\/td>\n<\/tr>\n<tr>\n<td>\u6838\u5fc3\u5b9a\u4f4d<\/td>\n<td>CPU \u8d44\u6e90\u5206\u914d\u7684\u6700\u5c0f\u5355\u4f4d<\/td>\n<td>CPU \u8c03\u5ea6\u6267\u884c\u7684\u6700\u5c0f\u5355\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\u6210\u672c\u7279\u6027<\/td>\n<td>\u521b\u5efa \/ \u9500\u6bc1\u6210\u672c\u9ad8&#xff08;\u91cd\u91cf\u7ea7&#xff09;<\/td>\n<td>\u521b\u5efa \/ \u9500\u6bc1\u6210\u672c\u4f4e&#xff08;\u8f7b\u91cf\u7ea7&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u524d\u7aef\u793a\u4f8b<\/td>\n<td>\u6d4f\u89c8\u5668\u6bcf\u65b0\u5f00\u4e00\u4e2a\u6807\u7b7e\u9875 &#061; \u65b0\u8fdb\u7a0b<\/td>\n<td>\u6d4f\u89c8\u5668\u8fdb\u7a0b\u5185\u5305\u542b\u591a\u7ebf\u7a0b&#xff1a;GUI \u6e32\u67d3\u7ebf\u7a0b\u3001JS \u5f15\u64ce\u7ebf\u7a0b\u3001\u5b9a\u65f6\u5668\u7ebf\u7a0b\u3001\u5f02\u6b65 HTTP \u8bf7\u6c42\u7ebf\u7a0b\u3001\u4e8b\u4ef6\u89e6\u53d1\u7ebf\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u91cc\u6709\u4e2a\u5173\u952e\u77e5\u8bc6\u70b9&#xff1a;JavaScript \u662f\u5355\u7ebf\u7a0b\u811a\u672c\u8bed\u8a00&#xff0c;\u4f46\u6d4f\u89c8\u5668\u662f\u591a\u7ebf\u7a0b\u3001\u591a\u8fdb\u7a0b\u7684\u3002JS \u7684\u5355\u7ebf\u7a0b\u610f\u5473\u7740\u5b83\u540c\u4e00\u65f6\u95f4\u53ea\u80fd\u505a\u4e00\u4ef6\u4e8b&#xff0c;\u800c\u6d4f\u89c8\u5668\u7684\u591a\u7ebf\u7a0b\u5219\u4e3a JS \u5b9e\u73b0\u5f02\u6b65\u63d0\u4f9b\u4e86\u57fa\u7840\u3002<\/p>\n<h3 id=\"%E4%BA%8C%E3%80%81%E6%A0%B8%E5%BF%83%E6%9C%BA%E5%88%B6%EF%BC%9AEvent%20Loop%EF%BC%88%E4%BA%8B%E4%BB%B6%E5%BE%AA%E7%8E%AF%EF%BC%89\">\u4e8c\u3001\u6838\u5fc3\u673a\u5236&#xff1a;Event Loop&#xff08;\u4e8b\u4ef6\u5faa\u73af&#xff09;<\/h3>\n<p>JS \u5355\u7ebf\u7a0b\u8981\u5904\u7406\u540c\u6b65\u548c\u5f02\u6b65\u4efb\u52a1&#xff0c;\u5168\u9760 Event Loop \u8fd9\u4e2a\u6838\u5fc3\u673a\u5236\u3002\u6211\u4eec\u5148\u62c6\u89e3\u5b83\u7684\u6267\u884c\u903b\u8f91\u3002<\/p>\n<h4 id=\"2.1%20%E5%90%8C%E6%AD%A5%E4%B8%8E%E5%BC%82%E6%AD%A5%E7%9A%84%E6%9C%AC%E8%B4%A8\">2.1 \u540c\u6b65\u4e0e\u5f02\u6b65\u7684\u672c\u8d28<\/h4>\n<ul>\n<li>\u540c\u6b65\u4ee3\u7801&#xff1a;\u6309\u987a\u5e8f\u6267\u884c&#xff0c;\u4f1a\u963b\u585e\u540e\u7eed\u4ee3\u7801&#xff08;\u6bd4\u5982\u666e\u901a\u7684console.log\u3001\u53d8\u91cf\u58f0\u660e&#xff09;&#xff1b;<\/li>\n<li>\u5f02\u6b65\u4ee3\u7801&#xff1a;\u4e0d\u963b\u585e\u4e3b\u7ebf\u7a0b&#xff0c;\u8fdb\u5165\u300c\u4efb\u52a1\u961f\u5217\u300d\u7b49\u5f85\u6267\u884c&#xff08;\u6bd4\u5982setTimeout\u3001\u7f51\u7edc\u8bf7\u6c42&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u4e3e\u4e2a\u7b80\u5355\u4f8b\u5b50&#xff1a;<\/p>\n<p>\/\/ \u540c\u6b65\u4ee3\u7801&#xff1a;\u987a\u5e8f\u6267\u884c<br \/>\nconsole.log(&#039;1&#039;);<br \/>\nconsole.log(&#039;2&#039;);<\/p>\n<p>\/\/ \u5f02\u6b65\u4ee3\u7801&#xff1a;\u5148\u6267\u884c\u540c\u6b65&#xff0c;\u518d\u6267\u884c\u5f02\u6b65<br \/>\nconsole.log(&#039;1&#039;);<br \/>\nsetTimeout(() &#061;&gt; console.log(&#039;2&#039;), 0);<br \/>\nconsole.log(&#039;3&#039;);<br \/>\n\/\/ \u8f93\u51fa&#xff1a;1 \u2192 3 \u2192 2<\/p>\n<h4 id=\"2.2%20%E5%AE%8F%E4%BB%BB%E5%8A%A1%E4%B8%8E%E5%BE%AE%E4%BB%BB%E5%8A%A1\">2.2 \u5b8f\u4efb\u52a1\u4e0e\u5fae\u4efb\u52a1<\/h4>\n<p>\u5f02\u6b65\u4efb\u52a1\u5e76\u975e\u300c\u4e00\u89c6\u540c\u4ec1\u300d&#xff0c;\u800c\u662f\u5206\u4e3a\u5b8f\u4efb\u52a1\u548c\u5fae\u4efb\u52a1&#xff0c;\u6267\u884c\u4f18\u5148\u7ea7\u6709\u660e\u786e\u533a\u5206&#xff1a;<\/p>\n<ul>\n<li>\u5b8f\u4efb\u52a1&#xff1a;\u811a\u672c\u4ee3\u7801\u672c\u8eab\u3001setTimeout\/setInterval\u3001I\/O \u64cd\u4f5c\u3001UI \u6e32\u67d3\u7b49&#xff1b;<\/li>\n<li>\u5fae\u4efb\u52a1&#xff1a;Promise.then\/catch\/finally\u3001queueMicrotask\u3001Node.js \u7684process.nextTick\u7b49\u3002<\/li>\n<\/ul>\n<h5 id=\"Event%20Loop%20%E5%AE%8C%E6%95%B4%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B\">Event Loop \u5b8c\u6574\u6267\u884c\u6d41\u7a0b<\/h5>\n<li>\u6267\u884c\u8c03\u7528\u6808\u4e2d\u7684\u540c\u6b65\u4ee3\u7801&#xff08;\u5b8f\u4efb\u52a1\u7684\u4e00\u90e8\u5206&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c\u5b8c\u540c\u6b65\u4ee3\u7801\u540e&#xff0c;\u6e05\u7a7a\u6240\u6709\u5fae\u4efb\u52a1\u961f\u5217&#xff08;\u6309\u987a\u5e8f\u6267\u884c&#xff09;&#xff1b;<\/li>\n<li>\u5982\u6709\u9700\u8981&#xff0c;\u6267\u884c UI \u6e32\u67d3&#xff1b;<\/li>\n<li>\u4ece\u5b8f\u4efb\u52a1\u961f\u5217\u4e2d\u53d6\u51fa\u4e00\u4e2a\u5b8f\u4efb\u52a1\u6267\u884c&#xff1b;<\/li>\n<li>\u91cd\u590d\u6b65\u9aa4 2-4&#xff0c;\u5f62\u6210\u300c\u4e8b\u4ef6\u5faa\u73af\u300d\u3002<\/li>\n<p>\u6838\u5fc3\u539f\u5219&#xff1a;\u5148\u540c\u6b65&#xff0c;\u518d\u5fae\u4efb\u52a1&#xff0c;\u6700\u540e\u5b8f\u4efb\u52a1&#xff1b;\u6bcf\u6b21\u6267\u884c\u5b8c\u4e00\u4e2a\u5b8f\u4efb\u52a1&#xff0c;\u90fd\u8981\u6e05\u7a7a\u5fae\u4efb\u52a1\u961f\u5217\u3002<\/p>\n<h3 id=\"%E4%B8%89%E3%80%81%E5%BC%82%E6%AD%A5%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%9APromise\">\u4e09\u3001\u5f02\u6b65\u89e3\u51b3\u65b9\u6848&#xff1a;Promise<\/h3>\n<p>\u65e9\u671f\u5f02\u6b65\u7f16\u7a0b\u4f9d\u8d56\u5d4c\u5957\u56de\u8c03\u51fd\u6570&#xff0c;\u5bb9\u6613\u5f62\u6210\u300c\u56de\u8c03\u5730\u72f1\u300d&#xff08;\u91d1\u5b57\u5854\u5f62\u4ee3\u7801\u3001\u9519\u8bef\u5904\u7406\u56f0\u96be\u3001\u590d\u7528\u6027\u5dee&#xff09;&#xff0c;\u800c Promise \u662f\u89e3\u51b3\u56de\u8c03\u5730\u72f1\u7684\u6807\u51c6\u65b9\u6848\u3002<\/p>\n<h4 id=\"3.1%20Promise%20%E6%A0%B8%E5%BF%83%E7%89%B9%E6%80%A7\">3.1 Promise \u6838\u5fc3\u7279\u6027<\/h4>\n<li>\n<p>\u4e09\u79cd\u72b6\u6001&#xff1a;<\/p>\n<ul>\n<li>pending&#xff1a;\u9ed8\u8ba4\u72b6\u6001&#xff08;\u7b49\u5f85\u4e2d&#xff09;&#xff1b;<\/li>\n<li>fulfilled&#xff1a;\u6210\u529f\u72b6\u6001&#xff08;\u4e0d\u53ef\u9006&#xff09;&#xff1b;<\/li>\n<li>rejected&#xff1a;\u5931\u8d25\u72b6\u6001&#xff08;\u4e0d\u53ef\u9006&#xff09;\u3002\u72b6\u6001\u53ea\u80fd\u4ecepending\u8f6c\u4e3afulfilled\u6216rejected&#xff0c;\u4e00\u65e6\u6539\u53d8\u5c31\u65e0\u6cd5\u4fee\u6539\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u94fe\u5f0f\u8c03\u7528&#xff1a;Promise \u7684then\u65b9\u6cd5\u4f1a\u8fd4\u56de\u65b0\u7684 Promise&#xff0c;\u652f\u6301\u94fe\u5f0f\u8c03\u7528&#xff0c;\u66ff\u4ee3\u5d4c\u5957\u56de\u8c03&#xff1a;<\/p>\n<p> \/\/ \u6a21\u62df\u5f02\u6b65\u8bf7\u6c42<br \/>\nfunction fetchUser(id) {<br \/>\n  return new Promise(resolve &#061;&gt; {<br \/>\n    setTimeout(() &#061;&gt; resolve({ id, name: &#096;\u7528\u6237${id}&#096; }), 1000);<br \/>\n  });<br \/>\n}<\/p>\n<p>function fetchPosts(userId) {<br \/>\n  return new Promise(resolve &#061;&gt; {<br \/>\n    setTimeout(() &#061;&gt; resolve([&#096;\u5e16\u5b501-${userId}&#096;, &#096;\u5e16\u5b502-${userId}&#096;]), 1000);<br \/>\n  });<br \/>\n}<\/p>\n<p>\/\/ \u94fe\u5f0f\u8c03\u7528&#xff1a;\u66ff\u4ee3\u5d4c\u5957<br \/>\nfetchUser(1)<br \/>\n  .then(user &#061;&gt; {<br \/>\n    console.log(&#039;\u7528\u6237:&#039;, user);<br \/>\n    return fetchPosts(user.id); \/\/ \u8fd4\u56de\u65b0Promise<br \/>\n  })<br \/>\n  .then(posts &#061;&gt; console.log(&#039;\u5e16\u5b50:&#039;, posts))<br \/>\n  .catch(error &#061;&gt; console.error(&#039;\u9519\u8bef:&#039;, error));\n <\/li>\n<h4 id=\"3.2%20Promise%20%E5%B8%B8%E7%94%A8%E9%9D%99%E6%80%81%E6%96%B9%E6%B3%95\">3.2 Promise \u5e38\u7528\u9759\u6001\u65b9\u6cd5<\/h4>\n<p>Promise \u63d0\u4f9b\u4e86\u591a\u4e2a\u9759\u6001\u65b9\u6cd5&#xff0c;\u6ee1\u8db3\u4e0d\u540c\u7684\u5f02\u6b65\u573a\u666f\u9700\u6c42&#xff1a;<\/p>\n<ul>\n<li>Promise.all&#xff1a;\u6240\u6709 Promise \u90fd\u6210\u529f\u624d\u8fd4\u56de\u6210\u529f&#xff0c;\u4e00\u4e2a\u5931\u8d25\u5219\u6574\u4f53\u5931\u8d25&#xff1b;<\/li>\n<li>Promise.race&#xff1a;\u591a\u4e2a Promise \u4e2d\u300c\u6700\u5feb\u5b8c\u6210\u300d\u7684\u90a3\u4e2a\u51b3\u5b9a\u7ed3\u679c&#xff08;\u65e0\u8bba\u6210\u529f \/ \u5931\u8d25&#xff09;&#xff1b;<\/li>\n<li>Promise.allSettled&#xff1a;\u7b49\u5f85\u6240\u6709 Promise \u5b8c\u6210&#xff08;\u65e0\u8bba\u6210\u529f \/ \u5931\u8d25&#xff09;&#xff0c;\u8fd4\u56de\u6bcf\u4e2a Promise \u7684\u7ed3\u679c&#xff1b;<\/li>\n<li>Promise.any&#xff1a;\u53ea\u8981\u6709\u4e00\u4e2a Promise \u6210\u529f\u5c31\u8fd4\u56de\u6210\u529f&#xff0c;\u5168\u90e8\u5931\u8d25\u624d\u8fd4\u56de\u5931\u8d25\u3002<\/li>\n<\/ul>\n<p>\u793a\u4f8b\u4ee3\u7801&#xff1a;<\/p>\n<p>\/\/ Promise.all&#xff1a;\u6279\u91cf\u8bf7\u6c42<br \/>\nPromise.all([fetchUser(1), fetchUser(2)])<br \/>\n  .then(users &#061;&gt; console.log(&#039;\u6240\u6709\u7528\u6237:&#039;, users))<br \/>\n  .catch(err &#061;&gt; console.error(&#039;\u5355\u4e2a\u5931\u8d25:&#039;, err));<\/p>\n<p>\/\/ Promise.race&#xff1a;\u8d85\u65f6\u63a7\u5236<br \/>\nPromise.race([<br \/>\n  fetchUser(1),<br \/>\n  new Promise((_, reject) &#061;&gt; setTimeout(() &#061;&gt; reject(&#039;\u8bf7\u6c42\u8d85\u65f6&#039;), 800))<br \/>\n])<br \/>\n.then(user &#061;&gt; console.log(&#039;\u8bf7\u6c42\u6210\u529f:&#039;, user))<br \/>\n.catch(err &#061;&gt; console.error(&#039;\u8bf7\u6c42\u5931\u8d25:&#039;, err));<\/p>\n<h4 id=\"3.3%20%E6%89%8B%E5%86%99%20Promise%EF%BC%88%E6%A0%B8%E5%BF%83%E5%AE%9E%E7%8E%B0%EF%BC%89\">3.3 \u624b\u5199 Promise&#xff08;\u6838\u5fc3\u5b9e\u73b0&#xff09;<\/h4>\n<p>\u7406\u89e3 Promise \u6700\u597d\u7684\u65b9\u5f0f\u662f\u624b\u5199\u4e00\u4e2a\u7b80\u6613\u7248&#xff0c;\u6838\u5fc3\u903b\u8f91\u5305\u62ec\u72b6\u6001\u7ba1\u7406\u3001\u56de\u8c03\u961f\u5217\u3001then \u65b9\u6cd5\u94fe\u5f0f\u8c03\u7528&#xff1a;<\/p>\n<p>const PENDING &#061; &#039;PENDING&#039;;<br \/>\nconst FULFILLED &#061; &#039;FULFILLED&#039;;<br \/>\nconst REJECTED &#061; &#039;REJECTED&#039;;<\/p>\n<p>class MyPromise {<br \/>\n  constructor(executor) {<br \/>\n    this.status &#061; PENDING; \/\/ \u9ed8\u8ba4\u72b6\u6001<br \/>\n    this.value &#061; undefined; \/\/ \u6210\u529f\u503c<br \/>\n    this.reason &#061; undefined; \/\/ \u5931\u8d25\u539f\u56e0<br \/>\n    this.onResolvedCallbacks &#061; []; \/\/ \u6210\u529f\u56de\u8c03\u961f\u5217<br \/>\n    this.onRejectedCallbacks &#061; []; \/\/ \u5931\u8d25\u56de\u8c03\u961f\u5217<\/p>\n<p>    \/\/ \u6210\u529f\u56de\u8c03<br \/>\n    const resolve &#061; (value) &#061;&gt; {<br \/>\n      if (this.status &#061;&#061;&#061; PENDING) {<br \/>\n        this.status &#061; FULFILLED;<br \/>\n        this.value &#061; value;<br \/>\n        this.onResolvedCallbacks.forEach(fn &#061;&gt; fn());<br \/>\n      }<br \/>\n    };<\/p>\n<p>    \/\/ \u5931\u8d25\u56de\u8c03<br \/>\n    const reject &#061; (reason) &#061;&gt; {<br \/>\n      if (this.status &#061;&#061;&#061; PENDING) {<br \/>\n        this.status &#061; REJECTED;<br \/>\n        this.reason &#061; reason;<br \/>\n        this.onRejectedCallbacks.forEach(fn &#061;&gt; fn());<br \/>\n      }<br \/>\n    };<\/p>\n<p>    try {<br \/>\n      executor(resolve, reject); \/\/ \u7acb\u5373\u6267\u884c\u6267\u884c\u5668<br \/>\n    } catch (error) {<br \/>\n      reject(error);<br \/>\n    }<br \/>\n  }<\/p>\n<p>  then(onFulfilled, onRejected) {<br \/>\n    \/\/ \u5904\u7406\u9ed8\u8ba4\u56de\u8c03<br \/>\n    onFulfilled &#061; typeof onFulfilled &#061;&#061;&#061; &#039;function&#039; ? onFulfilled : v &#061;&gt; v;<br \/>\n    onRejected &#061; typeof onRejected &#061;&#061;&#061; &#039;function&#039; ? onRejected : e &#061;&gt; { throw e };<\/p>\n<p>    const promise2 &#061; new MyPromise((resolve, reject) &#061;&gt; {<br \/>\n      if (this.status &#061;&#061;&#061; FULFILLED) {<br \/>\n        setTimeout(() &#061;&gt; {<br \/>\n          try {<br \/>\n            const x &#061; onFulfilled(this.value);<br \/>\n            this.resolvePromise(promise2, x, resolve, reject);<br \/>\n          } catch (e) {<br \/>\n            reject(e);<br \/>\n          }<br \/>\n        }, 0);<br \/>\n      }<\/p>\n<p>      if (this.status &#061;&#061;&#061; REJECTED) {<br \/>\n        setTimeout(() &#061;&gt; {<br \/>\n          try {<br \/>\n            const x &#061; onRejected(this.reason);<br \/>\n            this.resolvePromise(promise2, x, resolve, reject);<br \/>\n          } catch (e) {<br \/>\n            reject(e);<br \/>\n          }<br \/>\n        }, 0);<br \/>\n      }<\/p>\n<p>      if (this.status &#061;&#061;&#061; PENDING) {<br \/>\n        this.onResolvedCallbacks.push(() &#061;&gt; {<br \/>\n          setTimeout(() &#061;&gt; {<br \/>\n            try {<br \/>\n              const x &#061; onFulfilled(this.value);<br \/>\n              this.resolvePromise(promise2, x, resolve, reject);<br \/>\n            } catch (e) {<br \/>\n              reject(e);<br \/>\n            }<br \/>\n          }, 0);<br \/>\n        });<br \/>\n        this.onRejectedCallbacks.push(() &#061;&gt; {<br \/>\n          setTimeout(() &#061;&gt; {<br \/>\n            try {<br \/>\n              const x &#061; onRejected(this.reason);<br \/>\n              this.resolvePromise(promise2, x, resolve, reject);<br \/>\n            } catch (e) {<br \/>\n              reject(e);<br \/>\n            }<br \/>\n          }, 0);<br \/>\n        });<br \/>\n      }<br \/>\n    });<\/p>\n<p>    return promise2;<br \/>\n  }<\/p>\n<p>  \/\/ \u89e3\u6790Promise\u8fd4\u56de\u503c&#xff08;\u6838\u5fc3\u903b\u8f91&#xff09;<br \/>\n  resolvePromise(promise2, x, resolve, reject) {<br \/>\n    if (promise2 &#061;&#061;&#061; x) {<br \/>\n      return reject(new TypeError(&#039;\u5faa\u73af\u5f15\u7528&#039;));<br \/>\n    }<br \/>\n    let called &#061; false;<br \/>\n    if (x instanceof MyPromise) {<br \/>\n      x.then(y &#061;&gt; this.resolvePromise(promise2, y, resolve, reject), reject);<br \/>\n    } else if (x !&#061;&#061; null &amp;&amp; (typeof x &#061;&#061;&#061; &#039;object&#039; || typeof x &#061;&#061;&#061; &#039;function&#039;)) {<br \/>\n      try {<br \/>\n        const then &#061; x.then;<br \/>\n        if (typeof then &#061;&#061;&#061; &#039;function&#039;) {<br \/>\n          then.call(x, y &#061;&gt; {<br \/>\n            if (called) return;<br \/>\n            called &#061; true;<br \/>\n            this.resolvePromise(promise2, y, resolve, reject);<br \/>\n          }, e &#061;&gt; {<br \/>\n            if (called) return;<br \/>\n            called &#061; true;<br \/>\n            reject(e);<br \/>\n          });<br \/>\n        } else {<br \/>\n          resolve(x);<br \/>\n        }<br \/>\n      } catch (e) {<br \/>\n        if (called) return;<br \/>\n        called &#061; true;<br \/>\n        reject(e);<br \/>\n      }<br \/>\n    } else {<br \/>\n      resolve(x);<br \/>\n    }<br \/>\n  }<\/p>\n<p>  catch(onRejected) {<br \/>\n    return this.then(null, onRejected);<br \/>\n  }<br \/>\n}<\/p>\n<h3 id=\"%E5%9B%9B%E3%80%81%E8%AF%AD%E6%B3%95%E7%B3%96%EF%BC%9Aasync%2Fawait\">\u56db\u3001\u8bed\u6cd5\u7cd6&#xff1a;async\/await<\/h3>\n<p>async\/await\u662f Promise \u7684\u8bed\u6cd5\u7cd6&#xff0c;\u5b83\u8ba9\u5f02\u6b65\u4ee3\u7801\u770b\u8d77\u6765\u50cf\u540c\u6b65\u4ee3\u7801&#xff0c;\u5e95\u5c42\u4f9d\u7136\u57fa\u4e8e Promise \u5b9e\u73b0\u3002<\/p>\n<h4 id=\"%E6%A0%B8%E5%BF%83%E7%89%B9%E7%82%B9\">\u6838\u5fc3\u7279\u70b9<\/h4>\n<li>async\u51fd\u6570&#xff1a;\u58f0\u660e\u540e\u8fd4\u56de\u503c\u81ea\u52a8\u5305\u88c5\u4e3a Promise&#xff1b;<\/li>\n<li>await\u5173\u952e\u5b57&#xff1a;\u53ea\u80fd\u5728 async \u51fd\u6570\u5185\u4f7f\u7528&#xff0c;\u7b49\u5f85 Promise \u5b8c\u6210\u5e76\u8fd4\u56de\u7ed3\u679c&#xff1b;<\/li>\n<li>\u9519\u8bef\u5904\u7406&#xff1a;\u53ef\u901a\u8fc7try\/catch\u6355\u83b7\u5f02\u6b65\u9519\u8bef&#xff0c;\u66f4\u7b26\u5408\u540c\u6b65\u4ee3\u7801\u7684\u5199\u6cd5\u3002<\/li>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>async function fetchData() {<br \/>\n  try {<br \/>\n    const user &#061; await fetchUser(1);<br \/>\n    console.log(&#039;\u7528\u6237:&#039;, user);<br \/>\n    const posts &#061; await fetchPosts(user.id);<br \/>\n    console.log(&#039;\u5e16\u5b50:&#039;, posts);<br \/>\n    return posts;<br \/>\n  } catch (error) {<br \/>\n    console.error(&#039;\u8bf7\u6c42\u5931\u8d25:&#039;, error);<br \/>\n  }<br \/>\n}<\/p>\n<p>fetchData();<\/p>\n<h3 id=\"%E4%BA%94%E3%80%81%E6%80%BB%E7%BB%93\">\u4e94\u3001\u603b\u7ed3<\/h3>\n<p>JavaScript \u7684\u5f02\u6b65\u7f16\u7a0b\u4f53\u7cfb\u53ef\u4ee5\u603b\u7ed3\u4e3a&#xff1a;<\/p>\n<li>\u5e95\u5c42\u652f\u6491&#xff1a;\u6d4f\u89c8\u5668\u591a\u8fdb\u7a0b \/ \u591a\u7ebf\u7a0b\u4e3a JS \u5355\u7ebf\u7a0b\u63d0\u4f9b\u5f02\u6b65\u80fd\u529b&#xff1b;<\/li>\n<li>\u6838\u5fc3\u673a\u5236&#xff1a;Event Loop \u901a\u8fc7\u5b8f\u4efb\u52a1 \/ \u5fae\u4efb\u52a1\u961f\u5217\u5b9e\u73b0\u5f02\u6b65\u8c03\u5ea6&#xff1b;<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;Promise \u89e3\u51b3\u56de\u8c03\u5730\u72f1&#xff0c;async\/await \u8ba9 Promise \u5199\u6cd5\u66f4\u4f18\u96c5\u3002<\/li>\n<p>\u7406\u89e3\u8fd9\u4e9b\u6838\u5fc3\u6982\u5ff5&#xff0c;\u4e0d\u4ec5\u80fd\u5e2e\u4f60\u641e\u5b9a\u9762\u8bd5\u4e2d\u7684\u5f02\u6b65\u9ad8\u9891\u9898&#xff0c;\u66f4\u80fd\u8ba9\u4f60\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\u7cbe\u51c6\u5b9a\u4f4d\u5f02\u6b65\u76f8\u5173\u7684 bug&#xff08;\u6bd4\u5982\u5b9a\u65f6\u5668\u8bef\u5dee\u3001\u5b8f\u5fae\u4efb\u52a1\u6267\u884c\u987a\u5e8f\u95ee\u9898&#xff09;\u3002\u5f02\u6b65\u662f JS \u7684\u6838\u5fc3&#xff0c;\u4e5f\u662f\u524d\u7aef\u8fdb\u9636\u7684\u5fc5\u7ecf\u4e4b\u8def&#xff0c;\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u4f60\u5efa\u7acb\u6e05\u6670\u7684\u77e5\u8bc6\u4f53\u7cfb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e2a\u4eba\u7a7a\u95f4&#xff1a;https:\/\/blog.csdn.net\/m0_73589512https:\/\/blog.csdn.net\/m0_73589512<br \/>\n\u5927\u5bb6\u597d&#xff0c;\u6211\u662f\u53c1\u4f70\u4e07~~<br \/>\n\u5982\u679c\u672c\u6587\u5bf9\u60a8\u6709\u5e2e\u52a9&#xff0c;\u8bf7\u732e\u4e0a\u4f60\u7684\u5c0f\u2765(^_-)\u54df~~~<br \/>\n\u4f5c\u4e3a\u524d\u7aef\u5f00\u53d1\u8005&#xff0c;\u6211\u4eec\u6bcf\u5929\u90fd\u5728\u548c JavaScript \u7684\u5f02\u6b65\u7279\u6027\u6253\u4ea4\u9053 \u2014\u2014 \u5b9a\u65f6\u5668\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u4e8b\u4ef6\u56de\u8c03\u2026\u2026 \u4f46\u4f60\u771f\u7684\u7406\u89e3 JS \u5355\u7ebf\u7a0b\u4e0b\u7684\u5f02\u6b65\u5e95\u5c42\u903b\u8f91\u5417&#xff1f;\u672c\u6587\u5c06\u4ece\u8fdb\u7a0b\u7ebf\u7a0b\u57fa\u7840\u8bb2\u8d77&amp;<\/p>\n","protected":false},"author":2,"featured_media":62143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[187,87,190],"topic":[],"class_list":["post-62144","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-javascript","tag-87","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/62144.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e2a\u4eba\u7a7a\u95f4&#xff1a;https:\/\/blog.csdn.net\/m0_73589512https:\/\/blog.csdn.net\/m0_73589512 \u5927\u5bb6\u597d&#xff0c;\u6211\u662f\u53c1\u4f70\u4e07~~ \u5982\u679c\u672c\u6587\u5bf9\u60a8\u6709\u5e2e\u52a9&#xff0c;\u8bf7\u732e\u4e0a\u4f60\u7684\u5c0f\u2765(^_-)\u54df~~~ \u4f5c\u4e3a\u524d\u7aef\u5f00\u53d1\u8005&#xff0c;\u6211\u4eec\u6bcf\u5929\u90fd\u5728\u548c JavaScript \u7684\u5f02\u6b65\u7279\u6027\u6253\u4ea4\u9053 \u2014\u2014 \u5b9a\u65f6\u5668\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u4e8b\u4ef6\u56de\u8c03\u2026\u2026 \u4f46\u4f60\u771f\u7684\u7406\u89e3 JS \u5355\u7ebf\u7a0b\u4e0b\u7684\u5f02\u6b65\u5e95\u5c42\u903b\u8f91\u5417&#xff1f;\u672c\u6587\u5c06\u4ece\u8fdb\u7a0b\u7ebf\u7a0b\u57fa\u7840\u8bb2\u8d77&amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/62144.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-19T04:49:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260119044943-696db7e72902b.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62144.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/62144.html\",\"name\":\"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-19T04:49:44+00:00\",\"dateModified\":\"2026-01-19T04:49:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/62144.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/62144.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62144.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/62144.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e2a\u4eba\u7a7a\u95f4&#xff1a;https:\/\/blog.csdn.net\/m0_73589512https:\/\/blog.csdn.net\/m0_73589512 \u5927\u5bb6\u597d&#xff0c;\u6211\u662f\u53c1\u4f70\u4e07~~ \u5982\u679c\u672c\u6587\u5bf9\u60a8\u6709\u5e2e\u52a9&#xff0c;\u8bf7\u732e\u4e0a\u4f60\u7684\u5c0f\u2765(^_-)\u54df~~~ \u4f5c\u4e3a\u524d\u7aef\u5f00\u53d1\u8005&#xff0c;\u6211\u4eec\u6bcf\u5929\u90fd\u5728\u548c JavaScript \u7684\u5f02\u6b65\u7279\u6027\u6253\u4ea4\u9053 \u2014\u2014 \u5b9a\u65f6\u5668\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u4e8b\u4ef6\u56de\u8c03\u2026\u2026 \u4f46\u4f60\u771f\u7684\u7406\u89e3 JS \u5355\u7ebf\u7a0b\u4e0b\u7684\u5f02\u6b65\u5e95\u5c42\u903b\u8f91\u5417&#xff1f;\u672c\u6587\u5c06\u4ece\u8fdb\u7a0b\u7ebf\u7a0b\u57fa\u7840\u8bb2\u8d77&amp;","og_url":"https:\/\/www.wsisp.com\/helps\/62144.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-19T04:49:44+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260119044943-696db7e72902b.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/62144.html","url":"https:\/\/www.wsisp.com\/helps\/62144.html","name":"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-19T04:49:44+00:00","dateModified":"2026-01-19T04:49:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/62144.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/62144.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/62144.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165\u7406\u89e3 JavaScript \u5f02\u6b65\u7f16\u7a0b\uff1a\u4ece Event Loop \u5230 Promise"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=62144"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62144\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/62143"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=62144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=62144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=62144"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=62144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}