{"id":187032,"date":"2020-10-26T09:54:47","date_gmt":"2020-10-26T01:54:47","guid":{"rendered":"http:\/\/4563.org\/?p=187032"},"modified":"2020-10-26T09:54:47","modified_gmt":"2020-10-26T01:54:47","slug":"%e5%85%b3%e4%ba%8e%e8%8a%82%e6%b5%81%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=187032","title":{"rendered":"\u5173\u4e8e\u8282\u6d41\u51fd\u6570"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e\u8282\u6d41\u51fd\u6570               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rodrick <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e4b\u524d\u5b66\u7684\u65f6\u5019\u81ea\u5df1\u662f\u8fd9\u6837\u5199\u7684<\/p>\n<pre><code>function throttle(fn, wait) {       let lastTime = 0       let timer = null       let nowTime = new Date().getTime();        return function (...args) {         if (nowTime - lastTime &gt; wait) {           fn.apply(this, args)           lastTime = nowTime         } else if (timer === null) {           timer = setTimeout(() =&gt; {             timer = null             fn.apply(this, args)           }, wait)         }       }     } <\/code><\/pre>\n<p>\u4f7f\u7528\u7684\u65f6\u5019\u53d1\u73b0\u5982\u679c\u5b9a\u65f6\u5668\u7ed3\u675f\u6267\u884c fn.apply(this, args) \u7684\u8bdd\uff0c\u90a3\u4e48\u8fd9\u4e2a args \u662f\u5f53\u524d\u65f6\u95f4\u51cf\u53bb wait \u7684\u90a3\u4e2a\u65f6\u95f4\u70b9\u7684\u53c2\u6570\uff0c\u5e76\u4e0d\u662f\u5f53\u524d\u65f6\u95f4\u7684\u53c2\u6570<br \/> \u5728\u4e00\u4e9b\u76d1\u63a7\u6ed1\u52a8\u4f4d\u7f6e\u7b49\u60c5\u51b5\u65f6[args \u662f\u5f53\u524d\u4f4d\u7f6e\u4fe1\u606f]\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6267\u884c fn \u7684\u65f6\u5019\u5e76\u4e0d\u662f\u4f7f\u7528\u7684\u6700\u51c6\u786e\u7684\u4f4d\u7f6e\u4fe1\u606f\uff0c\u90a3\u4e48\u600e\u4e48\u80fd\u62ff\u5230\u51c6\u786e\u65f6\u95f4\u70b9\u7684\u53c2\u6570\u5462<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4046331\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : IsaacYoung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u53ef\u80fd\u9700\u8981\u9632\u6296                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4046332\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gyjames95 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u540c\u4e0a\u770b\u6cd5<br \/>\u76d1\u63a7\u6ed1\u52a8\u4f4d\u7f6e\u4e3a\u4ec0\u4e48\u8981\u7528\u8282\u6d41<br \/>\u5728\u6ed1\u52a8\u7ed3\u675f\u7684\u65f6\u5019\u63d0\u4ea4\u4e00\u4e0b\u4f4d\u7f6e\u6570\u636e\u4e0d\u5c31\u53ef\u4ee5\u4e86\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4046333\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : rodrick <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gyjames95 <br \/>@IsaacYoung <br \/>\u662f\u6ed1\u52a8\u7684\u8fc7\u7a0b\u4e2d\u53bb\u95f4\u9694\u6027\u89e6\u53d1\u4e8b\u4ef6\uff0c\u4e0d\u662f\u6ed1\u52a8\u7ed3\u675f\uff0c\u8fd9\u4e2a\u53ea\u662f\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e3b\u8981\u662f\u8fd9\u4e2a\u53c2\u6570\u4e0d\u662f\u51c6\u786e\u65f6\u95f4\u70b9\u7684\u53c2\u6570\u7684\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4046334\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : akaxiaok339 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &#8220;` js <br \/>function throttle(fn, wait) {<br \/> let lastTime = 0<br \/> let timer = null<br \/> let nowTime = new Date().getTime();<br \/> let params = null<br \/> return function (&#8230;args) {<br \/> params = args;<br \/> if (nowTime &#8211; lastTime &gt; wait) {<br \/> fn.apply(this, args)<br \/> lastTime = nowTime<br \/> } else if (timer === null) {<br \/> timer = setTimeout(() =&gt; {<br \/> timer = null<br \/> fn.apply(this, params)<br \/> }, wait)<br \/> }<br \/> }<br \/> }<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4046335\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : rodrick <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @akaxiaok339 \u5bb3&#8230;\u8fd9\u4e48\u7b80\u5355\u6211\u5c45\u7136\u6ca1\u60f3\u5230                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4046336\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hurrytospring <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             tail leading \u7684\u6982\u5ff5\uff1f\uff0c\u770b\u770b lodash \u91cc\u9762                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e\u8282\u6d41\u51fd\u6570 \u8cc7\u6df1\u5927\u4f6c : rod&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187032"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187032"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/187032\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187032"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}