<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 問題 Problem 你只想執行函數一次,把一系列的調用合并成一個單一的調用,在這一些列調用的開頭或者結尾執行。 You want to execute a function only once, coalescing multiple sequential calls into a single execution at the beginning or end. ## 方法 Solution 使用一個具名函數: With a named function: ~~~ debounce: (func, threshold, execAsap) -> timeout = null (args...) -> obj = this delayed = -> func.apply(obj, args) unless execAsap timeout = null if timeout clearTimeout(timeout) else if (execAsap) func.apply(obj, args) timeout = setTimeout delayed, threshold || 100 ~~~ ~~~ mouseMoveHandler: (e) -> @debounce((e) -> # Do something here, but only once 300 milliseconds after the mouse cursor stops. 300) someOtherHandler: (e) -> @debounce((e) -> # Do something here, but only once 250 milliseconds after initial execuction. 250, true) ~~~ ## 詳解 Discussion 參看John Hann的這篇很贊的文章[debouncing JavaScript methods](http://unscriptable.com/2009/03/20/debouncing-javascript-methods/)。 Learn about?[debouncing JavaScript methods](http://unscriptable.com/2009/03/20/debouncing-javascript-methods/)?at John Hann’s excellent blog article.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看