<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" >

  <channel>
    <title><![CDATA[Комментарии к публикации «Микропаттерны оптимизации в Javascript: декораторы функций debouncing и throttling»]]></title>
    <link>https://habr.com/ru/articles/60957/</link>
    <description><![CDATA[Комментарии к публикации «Микропаттерны оптимизации в Javascript: декораторы функций debouncing и throttling»]]></description>
    <language>ru</language>
    <managingEditor>editor@habr.com</managingEditor>
    <generator>habr.com</generator>
    <pubDate>Wed, 08 Jul 2026 05:18:40 GMT</pubDate>
    
    
      <image>
        <link>https://habr.com/ru/</link>
        <url>https://habrastorage.org/webt/ym/el/wk/ymelwk3zy1gawz4nkejl_-ammtc.png</url>
        <title>Хабр</title>
      </image>
    

    
      

      
        
  
    <item>
      <title>19.03.2019 03:30:46 xakplant</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_19906352</guid>
      <link>https://habr.com/ru/articles/60957/#comment_19906352</link>
      <description><![CDATA[Написал несколько примеров на простом JS, если кому-то надо то <a href="https://xakplant.ru/2019/03/18/%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-throttle-%D1%82%D1%80%D0%BE%D1%82%D0%BB%D0%B8%D0%BD%D0%B3%D0%B0-%D0%B2-javascript/">вот</a>]]></description>
      <pubDate>Tue, 19 Mar 2019 03:30:46 GMT</pubDate>
      <dc:creator><![CDATA[xakplant]]></dc:creator>
    </item>
  

  
    <item>
      <title>06.04.2017 12:48:41 developer</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_10158132</guid>
      <link>https://habr.com/ru/articles/60957/#comment_10158132</link>
      <description><![CDATA[Для задания контекста используется <a href="https://lodash.com/docs/4.17.4#bind">https://lodash.com/docs/4.17.4#bind</a>]]></description>
      <pubDate>Thu, 06 Apr 2017 12:48:41 GMT</pubDate>
      <dc:creator><![CDATA[developer]]></dc:creator>
    </item>
  

  
    <item>
      <title>06.04.2017 12:43:07 developer</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_10158110</guid>
      <link>https://habr.com/ru/articles/60957/#comment_10158110</link>
      <description><![CDATA[Актуальная информация:<br/>
данные методы находятся в реализации JS библиотеки <a href="https://lodash.com/">ladsh</a><br/>
<a href="https://lodash.com/docs/4.17.4#debounce">https://lodash.com/docs/4.17.4#debounce</a>]]></description>
      <pubDate>Thu, 06 Apr 2017 12:43:07 GMT</pubDate>
      <dc:creator><![CDATA[developer]]></dc:creator>
    </item>
  

  
    <item>
      <title>10.06.2014 23:27:32 lolmaus</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_7675401</guid>
      <link>https://habr.com/ru/articles/60957/#comment_7675401</link>
      <description><![CDATA[Поддерживаю. Статье пять лет, а актуальность сохраняется. Столкнулся с описанной задачей, а ничего более свежего и доступного не нашел.<br/>
<br/>
Под впечатлением от сабжа, сделал свою версию: <a href="https://github.com/lolmaus/jquery.timer-tools">github.com/lolmaus/jquery.timer-tools</a><br/>
<br/>
Отличия от сабжа:<br/>
<br/>
 — Изменен порядок аргументов. Колбэк теперь идет последним, что гораздо удобнее (см. примеры).<br/>
 — Добавлена функция delay — алиас для setTimeout с измененным порядком аргументов.<br/>
 — Debounce с исполнением колбэка в начале или в конце серии вызовов разделен на две отдельные функции.<br/>
 — Код throttle упрощен. Автор сабжа там перемудрил.<br/>
 — Плагин досутпен через Bower.]]></description>
      <pubDate>Tue, 10 Jun 2014 23:27:32 GMT</pubDate>
      <dc:creator><![CDATA[lolmaus]]></dc:creator>
    </item>
  

  
    <item>
      <title>03.06.2014 05:59:57 sa_melnikov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_7651021</guid>
      <link>https://habr.com/ru/articles/60957/#comment_7651021</link>
      <description><![CDATA[спасибо, вы мне много времени сэкономили]]></description>
      <pubDate>Tue, 03 Jun 2014 05:59:57 GMT</pubDate>
      <dc:creator><![CDATA[sa_melnikov]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.06.2009 10:19:48 c_project</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1669250</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1669250</link>
      <description><![CDATA[отлично. полезно… декораторы за частую развязывают руки…]]></description>
      <pubDate>Mon, 01 Jun 2009 10:19:48 GMT</pubDate>
      <dc:creator><![CDATA[c_project]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.06.2009 09:58:13 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1669168</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1669168</link>
      <description><![CDATA[Cмысл в том, что я использую jQuery в своей работе, и есть чувство, что такие «низкоуровневые» фичи имеет смысл тоже ложить в неймспейс фреймворка.]]></description>
      <pubDate>Mon, 01 Jun 2009 09:58:13 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.06.2009 09:55:41 Mourner</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1669157</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1669157</link>
      <description><![CDATA[Я их постоянно путаю, ну и придумали же названия :)]]></description>
      <pubDate>Mon, 01 Jun 2009 09:55:41 GMT</pubDate>
      <dc:creator><![CDATA[Mourner]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.06.2009 09:53:45 Mourner</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1669146</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1669146</link>
      <description><![CDATA[В коде вообще ничего нет от jQuery кроме того, что вы функции положили в его неймспейс. :) Поэтому не вижу никакого смысла оформлять это как плагин для jQuery.]]></description>
      <pubDate>Mon, 01 Jun 2009 09:53:45 GMT</pubDate>
      <dc:creator><![CDATA[Mourner]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.06.2009 03:19:24 chiaroscuro</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1668077</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1668077</link>
      <description><![CDATA[Окей, напишу, как появится свободное время.]]></description>
      <pubDate>Mon, 01 Jun 2009 03:19:24 GMT</pubDate>
      <dc:creator><![CDATA[chiaroscuro]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 17:46:21 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667399</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667399</link>
      <description><![CDATA[У вас throttling, а не debouncing :)]]></description>
      <pubDate>Sun, 31 May 2009 17:46:21 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 17:38:21 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667384</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667384</link>
      <description><![CDATA[Я ничего не изобретал, я сделал свою жизнь, с точки зрения веб-разработчика немного проще и написал об этом. Если у вас мощная теоретическая база для этого — написали бы, я бы с удовольствием почитал.]]></description>
      <pubDate>Sun, 31 May 2009 17:38:21 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 17:18:41 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667345</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667345</link>
      <description><![CDATA[Написанное в статье справедливо для Javascript'а в целом, а не jQuery. Сам плагин легко переписывается без jQuery.]]></description>
      <pubDate>Sun, 31 May 2009 17:18:41 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 17:15:32 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667337</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667337</link>
      <description><![CDATA[Потому что на каждый клик у вас создается новый экземпляр задекорированной функции. Надо сделать так:<br/>
<br/>
<blockquote><code><font color="black"><font color="#0000ff">var</font> onload = $.debounce(<font color="#0000ff">function</font>(_e) {<br/>
 console.log(<font color="#A31515">'loaded'</font>);<br/>
}, 1000);<br/>
<br/>
<font color="#0000ff">var</font> test = <font color="#0000ff">function</font>() {<br/>
 $.ajax({<br/>
  <font color="#A31515">'url'</font>: <font color="#A31515">'http://myhost/blablabla'</font>,<br/>
  <font color="#A31515">'success'</font>: onload<br/>
 })<br/>
};</font><br/>
<br/>
<font color="gray">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><font color="gray">Source Code Highlighter</font></a>.</font></code></blockquote>]]></description>
      <pubDate>Sun, 31 May 2009 17:15:32 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 15:12:56 4pcbr</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667129</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667129</link>
      <description><![CDATA[Автор ничего не изобретал, он же пишет: «Навеяно книжкой Николаса Закаса».<br/>
<br/>
А реализация модуля по мотивам удобного паттерна в различных библиотеках — только плюс разработчикам.]]></description>
      <pubDate>Sun, 31 May 2009 15:12:56 GMT</pubDate>
      <dc:creator><![CDATA[4pcbr]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 15:00:33 chiaroscuro</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667103</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667103</link>
      <description><![CDATA[Поздравляю, вы только что переизобрели несколько комбинаторов из Flapjax (flapjax-lang.org):<br/>
— blindE (аналог debounce)<br/>
— calmE (аналог throttle)<br/>
<br/>
Только вот Flapjax основан на мощной теоретической базе, и реализация довольно продвинутая.]]></description>
      <pubDate>Sun, 31 May 2009 15:00:33 GMT</pubDate>
      <dc:creator><![CDATA[chiaroscuro]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 14:59:11 Mourner</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667099</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667099</link>
      <description><![CDATA[Мой вариант debouncing: <a href="http://habrahabr.ru/blogs/webdev/17884/">habrahabr.ru/blogs/webdev/17884/</a> (не знал тогда, что это так называется :)]]></description>
      <pubDate>Sun, 31 May 2009 14:59:11 GMT</pubDate>
      <dc:creator><![CDATA[Mourner]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 14:12:13 AlexFrost</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1667014</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1667014</link>
      <description><![CDATA[Может, стоит перенести в блог jQuery? Когда я начал читать, удивился, подумав что это реализовано в <br/>
джаваскрипте по умолчанию, только ближе к концу стало очевидно, что это реализовано в виде плагина к jQuery.<br/>
<br/>
За статью спасибо, пригодиться в новом проекте.<br/>
]]></description>
      <pubDate>Sun, 31 May 2009 14:12:13 GMT</pubDate>
      <dc:creator><![CDATA[AlexFrost]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 12:10:54 Pilat</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666815</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666815</link>
      <description><![CDATA[Точно, я невнимательно прочитал. Ну вот и ещё одно применение — кэширование — доработке функций.]]></description>
      <pubDate>Sun, 31 May 2009 12:10:54 GMT</pubDate>
      <dc:creator><![CDATA[Pilat]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 11:32:52 4pcbr</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666732</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666732</link>
      <description><![CDATA[А при чем тут кеширование и debounce? у них идеи противоположные.]]></description>
      <pubDate>Sun, 31 May 2009 11:32:52 GMT</pubDate>
      <dc:creator><![CDATA[4pcbr]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 11:27:19 Pilat</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666722</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666722</link>
      <description><![CDATA[Примеры хорошие, но было бы интересней иметь библиотеку манипуляции функциями — функции before/after, кэширование (которое зачем-то назвали debounce), может что-то ещё кому в голову придёт?<br/>
]]></description>
      <pubDate>Sun, 31 May 2009 11:27:19 GMT</pubDate>
      <dc:creator><![CDATA[Pilat]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 11:22:02 4pcbr</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666711</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666711</link>
      <description><![CDATA[Ну если нас интересует отслеживание выполнения функции в определенный период времени, то здесь имеет место быть контекст событийности.<br/>
<br/>
Не получилось реализовать чтото вроде:<br/>
<br/>
var onload = function(_e) {<br/>
  console.log('loaded');<br/>
};<br/>
var test = function() {<br/>
  $.ajax({<br/>
    'url': 'http://myhost/blablabla',<br/>
    'success': $.debounce(onload, 1000)<br/>
  })<br/>
}<br/>
<br/>
Если повесить test() на onClick кнопки, то функция будет выполняться каждый раз с этой задержкой, без фильтрации. Пример возник из невнятной идеи: запрос отправляется постоянно по событию а апдейт dom например происходит не чаще чем какойто интервал времени.]]></description>
      <pubDate>Sun, 31 May 2009 11:22:02 GMT</pubDate>
      <dc:creator><![CDATA[4pcbr]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 11:12:52 dfilatov</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666695</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666695</link>
      <description><![CDATA[debounce и bind могут применяться не только для обработчиков событий, поэтому делать debounceBind было бы странным. debounceBind может быть надстройкой над debounce.<br/>
<br/>
А что у вас именно не получилось с $.ajax.success? ]]></description>
      <pubDate>Sun, 31 May 2009 11:12:52 GMT</pubDate>
      <dc:creator><![CDATA[dfilatov]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 11:07:31 4pcbr</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666684</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666684</link>
      <description><![CDATA[Вероятно, было бы удобней реализовать в виде $(selector). debounceBind(type, data, fn), и в data подавать параметр задержки.<br/>
<br/>
Кстати, код можно оформить и по jsDoc.<br/>
<br/>
Не удалось адекватно повесить биндер на $.ajax.success, правда, задача не совсем жизненная: )<br/>
<br/>
В целом реализация хорошая. Спасибо.]]></description>
      <pubDate>Sun, 31 May 2009 11:07:31 GMT</pubDate>
      <dc:creator><![CDATA[4pcbr]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 10:38:09 hlomzik</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666591</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666591</link>
      <description><![CDATA[Идеи хорошие, паттерны — они такие, воздушные, казалось бы очевидные ;)<br/>
Но вот можно было сделать реализацию на чистом js. Без этого пустовато.]]></description>
      <pubDate>Sun, 31 May 2009 10:38:09 GMT</pubDate>
      <dc:creator><![CDATA[hlomzik]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 10:20:37 Iskin</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666549</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666549</link>
      <description><![CDATA[Круто, код становится прекрасным — обожаю JS :)]]></description>
      <pubDate>Sun, 31 May 2009 10:20:37 GMT</pubDate>
      <dc:creator><![CDATA[Iskin]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 10:19:42 alexbig</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666545</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666545</link>
      <description><![CDATA[Спасибо. Полезные сведения и примеры отличные.<br/>
]]></description>
      <pubDate>Sun, 31 May 2009 10:19:42 GMT</pubDate>
      <dc:creator><![CDATA[alexbig]]></dc:creator>
    </item>
  

  
    <item>
      <title>31.05.2009 08:57:48 romy4</title>
      <guid isPermaLink="true">https://habr.com/ru/articles/60957/#comment_1666422</guid>
      <link>https://habr.com/ru/articles/60957/#comment_1666422</link>
      <description><![CDATA[очень полезно. спасибо]]></description>
      <pubDate>Sun, 31 May 2009 08:57:48 GMT</pubDate>
      <dc:creator><![CDATA[romy4]]></dc:creator>
    </item>
  

      

      

    
  </channel>
</rss>
