{"id":38336,"date":"2026-01-29T06:40:49","date_gmt":"2026-01-29T03:40:49","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=38336"},"modified":"2026-01-29T06:40:49","modified_gmt":"2026-01-29T03:40:49","slug":"throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/","title":{"rendered":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi"},"content":{"rendered":"<p><body><\/p>\n<h2>Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi<\/h2>\n<h2>Giri\u015f<\/h2>\n<p>Modern web uygulamalar\u0131, kullan\u0131c\u0131 etkile\u015fimini art\u0131rmak ve zengin bir deneyim sunmak amac\u0131yla s\u00fcrekli olarak \u00e7e\u015fitli etkinlikleri (event) dinler ve bunlara tepki verir. Klavye giri\u015fleri, fare hareketleri, kayd\u0131rma olaylar\u0131, pencere boyutland\u0131rma gibi bir\u00e7ok olay, kullan\u0131c\u0131 aray\u00fcz\u00fcn\u00fcn dinamik ve etkile\u015fimli olmas\u0131n\u0131 sa\u011flar. Ancak, bu olaylar\u0131n \u00e7ok s\u0131k tetiklenmesi durumunda ciddi performans sorunlar\u0131 ortaya \u00e7\u0131kabilir. \u00d6rne\u011fin, bir arama kutusuna her tu\u015f vuru\u015funda bir API iste\u011fi g\u00f6ndermek, gereksiz a\u011f trafi\u011fi ve sunucu y\u00fck\u00fc yaratabilir. Benzer \u015fekilde, bir kayd\u0131rma olay\u0131nda her piksel hareketinde karma\u015f\u0131k bir hesaplama yapmak, kullan\u0131c\u0131 aray\u00fcz\u00fcn\u00fcn tak\u0131lmas\u0131na veya yava\u015flamas\u0131na neden olabilir.<\/p>\n<p>\u0130\u015fte bu noktada &#8220;throttling&#8221; (k\u0131s\u0131tlama) ve &#8220;debouncing&#8221; (geciktirme\/yava\u015flatma) teknikleri devreye girer. Bu iki g\u00fc\u00e7l\u00fc kavram, etkinlikleri daha verimli bir \u015fekilde y\u00f6neterek hem uygulama performans\u0131n\u0131 art\u0131r\u0131r hem de kullan\u0131c\u0131lara daha ak\u0131c\u0131 bir deneyim sunar. Vue.js gibi reaktif bir framework ile \u00e7al\u0131\u015f\u0131rken, bu teknikleri do\u011fru bir \u015fekilde uygulamak, \u00f6zellikle b\u00fcy\u00fck ve karma\u015f\u0131k uygulamalarda kritik \u00f6neme sahiptir. Bu makalede, throttling ve debouncing kavramlar\u0131n\u0131 derinlemesine inceleyecek, ne zaman ve neden kullan\u0131ld\u0131klar\u0131n\u0131 a\u00e7\u0131klayacak, ve Lodash k\u00fct\u00fcphanesini kullanarak Vue.js uygulamalar\u0131nda nas\u0131l etkin bir \u015fekilde uygulayaca\u011f\u0131m\u0131z\u0131 detayl\u0131 kod \u00f6rnekleriyle g\u00f6sterece\u011fiz.<\/p>\n<h2>Sorunu Anlamak: S\u0131k Tetiklenen Etkinlikler<\/h2>\n<p>Web uygulamalar\u0131nda s\u0131k\u00e7a kar\u015f\u0131la\u015f\u0131lan ve kontrol edilmedi\u011finde sorunlara yol a\u00e7an baz\u0131 etkinlik t\u00fcrleri vard\u0131r. Bu etkinlikler, genellikle kullan\u0131c\u0131 aray\u00fcz\u00fcyle yo\u011fun etkile\u015fim gerektiren senaryolarda ortaya \u00e7\u0131kar.<\/p>\n<h3>S\u0131k Tetiklenen Etkinlik T\u00fcrleri<\/h3>\n<p>*   <strong><code>input<\/code> Etkinlikleri:<\/strong> Arama \u00e7ubuklar\u0131, metin alanlar\u0131 veya di\u011fer form giri\u015flerinde her tu\u015f vuru\u015funda veya giri\u015f de\u011fi\u015fikli\u011finde tetiklenir. \u00d6rne\u011fin, bir arama kutusuna &#8220;vuejs&#8221; yazarken, &#8216;v&#8217;, &#8216;u&#8217;, &#8216;e&#8217;, &#8216;j&#8217;, &#8216;s&#8217; i\u00e7in ayr\u0131 ayr\u0131 <code>input<\/code> etkinlikleri tetiklenir.<br \/>\n*   <strong><code>scroll<\/code> Etkinlikleri:<\/strong> Kullan\u0131c\u0131 bir sayfay\u0131 veya belirli bir \u00f6\u011feyi kayd\u0131rd\u0131\u011f\u0131nda tetiklenir. Sonsuz kayd\u0131rma (infinite scroll), paralaks efektleri veya kayd\u0131rma konumuna g\u00f6re UI g\u00fcncellemeleri gibi \u00f6zelliklerde yo\u011fun olarak kullan\u0131l\u0131r. Bu etkinlik, saniyede onlarca hatta y\u00fczlerce kez tetiklenebilir.<br \/>\n*   <strong><code>resize<\/code> Etkinlikleri:<\/strong> Taray\u0131c\u0131 penceresinin veya belirli bir \u00f6\u011fenin boyutu de\u011fi\u015ftirildi\u011finde tetiklenir. Duyarl\u0131 tasar\u0131m (responsive design) d\u00fczenlemeleri, tuval (canvas) boyutland\u0131rma veya grafiklerin yeniden \u00e7izilmesi gibi durumlarda kullan\u0131l\u0131r. Pencere s\u00fcr\u00fcklenerek boyutland\u0131r\u0131l\u0131rken s\u00fcrekli tetiklenir.<br \/>\n*   <strong><code>mousemove<\/code> Etkinlikleri:<\/strong> Fare bir \u00f6\u011fe \u00fczerinde hareket ettirildi\u011finde tetiklenir. S\u00fcr\u00fckle-b\u0131rak (drag-and-drop) i\u015flevleri, \u00e7izim ara\u00e7lar\u0131 veya fare konumuna ba\u011fl\u0131 olarak UI g\u00fcncellemeleri gibi senaryolarda kullan\u0131l\u0131r. \u00c7ok hassas bir \u015fekilde, her piksel hareketinde tetiklenebilir.<br \/>\n*   <strong><code>keyup<\/code>\/<code>keydown<\/code> Etkinlikleri:<\/strong> Klavye tu\u015flar\u0131na bas\u0131ld\u0131\u011f\u0131nda veya b\u0131rak\u0131ld\u0131\u011f\u0131nda tetiklenir. Otomatik kaydetme, ger\u00e7ek zamanl\u0131 do\u011frulama veya klavye k\u0131sayollar\u0131 gibi \u00f6zelliklerde kullan\u0131l\u0131r.<\/p>\n<h3>Kontrol Edilmeyen Etkinliklerin Sonu\u00e7lar\u0131<\/h3>\n<p>Bu etkinliklerin kontrols\u00fcz bir \u015fekilde i\u015flenmesi, bir dizi olumsuz sonuca yol a\u00e7abilir:<br \/>\n*   <strong>Performans D\u00fc\u015f\u00fc\u015f\u00fc:<\/strong> Her etkinlik tetiklendi\u011finde a\u011f\u0131r hesaplamalar veya DOM manip\u00fclasyonlar\u0131 yap\u0131lmas\u0131, uygulaman\u0131n yava\u015flamas\u0131na, tak\u0131lmas\u0131na ve hatta donmas\u0131na neden olabilir. Kullan\u0131c\u0131 aray\u00fcz\u00fc tepkisiz hale gelebilir.<br \/>\n*   <strong>Y\u00fcksek CPU\/Bellek Kullan\u0131m\u0131:<\/strong> S\u00fcrekli \u00e7al\u0131\u015fan i\u015flevler ve yeniden \u00e7izimler, i\u015flemci ve bellek kaynaklar\u0131n\u0131 a\u015f\u0131r\u0131 derecede t\u00fcketebilir, bu da \u00f6zellikle mobil cihazlarda veya d\u00fc\u015f\u00fck donan\u0131ml\u0131 sistemlerde k\u00f6t\u00fc bir deneyime yol a\u00e7ar.<br \/>\n*   <strong>Gereksiz A\u011f \u0130stekleri:<\/strong> Arama \u00e7ubu\u011fu \u00f6rne\u011finde oldu\u011fu gibi, her tu\u015f vuru\u015funda bir API iste\u011fi g\u00f6ndermek, sunucu \u00fczerinde gereksiz y\u00fck olu\u015fturur, bant geni\u015fli\u011fini t\u00fcketir ve kullan\u0131c\u0131n\u0131n veri plan\u0131n\u0131 h\u0131zla bitirebilir.<br \/>\n*   <strong>K\u00f6t\u00fc Kullan\u0131c\u0131 Deneyimi:<\/strong> Yava\u015f ve tepkisiz bir uygulama, kullan\u0131c\u0131lar\u0131n hayal k\u0131r\u0131kl\u0131\u011f\u0131na u\u011framas\u0131na ve uygulamay\u0131 terk etmelerine neden olabilir. Kullan\u0131c\u0131lar, h\u0131zl\u0131 ve ak\u0131c\u0131 bir deneyim beklerler.<\/p>\n<p>Throttling ve debouncing, bu sorunlar\u0131 \u00e7\u00f6zmek i\u00e7in tasarlanm\u0131\u015f stratejilerdir. \u015eimdi bu iki tekni\u011fi ayr\u0131 ayr\u0131 inceleyelim.<\/p>\n<h2>Debouncing: Etkinlikleri Geciktirme<\/h2>\n<p>Debouncing, belirli bir etkinlik tetiklenmeyi b\u0131rakt\u0131\u011f\u0131nda, belirli bir s\u00fcre sonra i\u015flevin yaln\u0131zca bir kez \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131n\u0131 sa\u011flayan bir tekniktir. Amac\u0131, h\u0131zl\u0131 ve ard\u0131\u015f\u0131k olarak tetiklenen bir dizi olay\u0131 tek bir olaya d\u00f6n\u00fc\u015ft\u00fcrmektir.<\/p>\n<h3>Debouncing Nedir?<\/h3>\n<p>Debouncing, bir etkinlik belirli bir s\u00fcre boyunca tekrar tetiklenmedi\u011finde, ilgili i\u015flevin yaln\u0131zca bir kez y\u00fcr\u00fct\u00fclmesini garanti eder. E\u011fer s\u00fcre dolmadan etkinlik tekrar tetiklenirse, \u00f6nceki say\u0131m s\u0131f\u0131rlan\u0131r ve yeni bir say\u0131m ba\u015flar. Bu, kullan\u0131c\u0131n\u0131n eylemi tamamlamas\u0131n\u0131 bekleyip, ard\u0131ndan tek bir i\u015flem yapmaya benzer.<\/p>\n<p><strong>Analoji:<\/strong> Bir asans\u00f6r\u00fcn kap\u0131 kapanma d\u00fc\u011fmesini d\u00fc\u015f\u00fcn\u00fcn. D\u00fc\u011fmeye her bas\u0131ld\u0131\u011f\u0131nda, kap\u0131n\u0131n kapanmas\u0131 i\u00e7in geri say\u0131m yeniden ba\u015flar. Ancak, kimse d\u00fc\u011fmeye basmad\u0131\u011f\u0131nda belirli bir s\u00fcre sonra kap\u0131lar kapan\u0131r. Debouncing tam olarak bu mant\u0131kla \u00e7al\u0131\u015f\u0131r.<\/p>\n<h3>Ne Zaman Debouncing Kullan\u0131l\u0131r?<\/h3>\n<p>Debouncing, genellikle kullan\u0131c\u0131n\u0131n bir dizi eylemi tamamlamas\u0131n\u0131 bekleyip, ard\u0131ndan bu eylemlerin sonucunu i\u015flemek istedi\u011finiz durumlarda tercih edilir.<br \/>\n*   <strong>Arama Giri\u015f Alanlar\u0131:<\/strong> Kullan\u0131c\u0131 bir arama kutusuna yazarken, her tu\u015f vuru\u015funda API iste\u011fi g\u00f6ndermek yerine, kullan\u0131c\u0131 yazmay\u0131 b\u0131rakt\u0131\u011f\u0131nda (\u00f6rne\u011fin 300-500ms sonra) tek bir arama iste\u011fi g\u00f6ndermek i\u00e7in kullan\u0131l\u0131r.<br \/>\n*   <strong>Ger\u00e7ek Zamanl\u0131 Form Do\u011frulama:<\/strong> Bir form alan\u0131na veri girilirken, her tu\u015f vuru\u015funda do\u011frulama yapmak yerine, kullan\u0131c\u0131 yazmay\u0131 durdurdu\u011funda do\u011frulama yapmak daha verimlidir.<br \/>\n*   <strong>Otomatik Kaydetme \u00d6zellikleri:<\/strong> Bir metin d\u00fczenleyicide kullan\u0131c\u0131 de\u011fi\u015fiklikler yaparken, her de\u011fi\u015fikli\u011fi an\u0131nda kaydetmek yerine, kullan\u0131c\u0131n\u0131n bir s\u00fcre i\u015flem yapmad\u0131\u011f\u0131nda otomatik olarak kaydetmek i\u00e7in idealdir.<br \/>\n*   <strong>Pencere Boyutland\u0131rma (Resize):<\/strong> Pencere boyutu de\u011fi\u015ftirildi\u011finde, d\u00fczeni yeniden hesaplamak veya karma\u015f\u0131k grafikler \u00e7izmek genellikle maliyetlidir. Debouncing ile, kullan\u0131c\u0131 pencere boyutland\u0131rmay\u0131 tamamlad\u0131\u011f\u0131nda tek bir yeniden boyutland\u0131rma i\u015flemi tetiklenebilir.<\/p>\n<h3>Lodash ile Debouncing Uygulamas\u0131<\/h3>\n<p>Lodash, JavaScript i\u00e7in pop\u00fcler bir yard\u0131mc\u0131 program k\u00fct\u00fcphanesidir ve <code>_.debounce<\/code> i\u015flevi ile debouncing uygulamas\u0131n\u0131 son derece kolayla\u015ft\u0131r\u0131r.<\/p>\n<p>\u00d6ncelikle Lodash&#8217;i projenize dahil etmeniz gerekir:<\/p>\n<pre><code class=\"language-bash\">npm install lodash\n<h2>veya<\/h2>\nyarn add lodash<\/code><\/pre>\n<p>Ard\u0131ndan, Vue.js bile\u015feninizde kullanabilirsiniz.<\/p>\n<p><strong>\u00d6rnek 1: Basit Arama Kutusu<\/strong><\/p>\n<pre><code class=\"language-vue\"><template>\n  <div>\n    <h2>Debouncing ile Arama<\/h2>\n    <input type=\"text\" v-model=\"searchText\" @input=\"handleSearchInput\" placeholder=\"Arama yap...\" \/>\n    <p>Aranan Kelime: {{ displayedSearchText }}<\/p>\n    <p v-if=\"loading\">Aran\u0131yor...<\/p>\n  <\/div>\n<\/template>\n\n<script>\nimport _ from 'lodash';\n\nexport default {\n  data() {\n    return {\n      searchText: '',\n      displayedSearchText: '',\n      loading: false,\n      \/\/ Debounced fonksiyonu burada tan\u0131mlayaca\u011f\u0131z\n      debouncedSearch: null,\n    };\n  },\n  created() {\n    \/\/ <code>created<\/code> ya\u015fam d\u00f6ng\u00fcs\u00fc kancas\u0131nda debounced fonksiyonu olu\u015fturun\n    \/\/ <code>this.performSearch<\/code> metodunu 500ms gecikmeyle \u00e7al\u0131\u015ft\u0131racak.\n    \/\/ <code>.bind(this)<\/code> kullanarak <code>this<\/code> ba\u011flam\u0131n\u0131 korumak \u00f6nemlidir.\n    this.debouncedSearch = _.debounce(this.performSearch.bind(this), 500);\n  },\n  methods: {\n    handleSearchInput() {\n      \/\/ Kullan\u0131c\u0131 inputa her yazd\u0131\u011f\u0131nda debounced fonksiyonu \u00e7a\u011f\u0131r\n      \/\/ E\u011fer 500ms i\u00e7inde tekrar yazarsa, \u00f6nceki \u00e7a\u011fr\u0131 iptal edilir ve yeni bir say\u0131m ba\u015flar.\n      this.loading = true; \/\/ Arama ba\u015flad\u0131\u011f\u0131n\u0131 belirtmek i\u00e7in\n      this.debouncedSearch();\n    },\n    performSearch() {\n      \/\/ Bu fonksiyon, kullan\u0131c\u0131 yazmay\u0131 b\u0131rakt\u0131ktan 500ms sonra \u00e7al\u0131\u015facak\n      console.log('API \u00e7a\u011fr\u0131s\u0131 yap\u0131l\u0131yor:', this.searchText);\n      this.displayedSearchText = this.searchText;\n      this.loading = false; \/\/ Arama bitti\u011fini belirtmek i\u00e7in\n      \/\/ Burada ger\u00e7ek bir API \u00e7a\u011fr\u0131s\u0131 yapabilirsiniz\n      \/\/ fetch(<code>\/api\/search?q=${this.searchText}<\/code>).then(...)\n    },\n  },\n  beforeUnmount() {\n    \/\/ Bile\u015fen yok edilmeden \u00f6nce debounced fonksiyonunu iptal edin\n    \/\/ Bellek s\u0131z\u0131nt\u0131lar\u0131n\u0131 ve istenmeyen davran\u0131\u015flar\u0131 \u00f6nlemek i\u00e7in \u00f6nemlidir.\n    if (this.debouncedSearch && typeof this.debouncedSearch.cancel === 'function') {\n      this.debouncedSearch.cancel();\n    }\n  },\n};\n<\/script><\/code><\/pre>\n<p><strong>A\u00e7\u0131klama:<\/strong><br \/>\n*   <code>created()<\/code> kancas\u0131nda <code>_.debounce(this.performSearch.bind(this), 500)<\/code> ile <code>performSearch<\/code> metodunu debounced hale getiriyoruz. <code>500<\/code> milisaniye, kullan\u0131c\u0131n\u0131n yazmay\u0131 b\u0131rakt\u0131ktan sonra ne kadar beklenece\u011fini belirtir.<br \/>\n*   <code>bind(this)<\/code> kullanmak, <code>performSearch<\/code> metodu i\u00e7inde <code>this<\/code>&#8216;in do\u011fru Vue bile\u015fen \u00f6rne\u011fine i\u015faret etmesini sa\u011flar.<br \/>\n*   <code>handleSearchInput<\/code> metodu, her <code>input<\/code> olay\u0131nda <code>this.debouncedSearch()<\/code> \u00e7a\u011f\u0131r\u0131r. Lodash, bu \u00e7a\u011fr\u0131lar\u0131 dahili olarak y\u00f6netir ve yaln\u0131zca son \u00e7a\u011fr\u0131dan 500ms sonra <code>performSearch<\/code>&#8216;\u00fc tetikler.<br \/>\n*   <code>beforeUnmount()<\/code> (Vue 3) veya <code>beforeDestroy()<\/code> (Vue 2) kancas\u0131nda <code>this.debouncedSearch.cancel()<\/code> metodunu \u00e7a\u011f\u0131rarak bekleyen debounced \u00e7a\u011fr\u0131lar\u0131n\u0131 temizlemek, bellek s\u0131z\u0131nt\u0131lar\u0131n\u0131 ve istenmeyen davran\u0131\u015flar\u0131 \u00f6nlemek i\u00e7in kritik \u00f6neme sahiptir.<\/p>\n<p><strong><code>_.debounce<\/code> Parametreleri:<\/strong><br \/>\n*   <code>func (Function)<\/code>: Debounce uygulanacak i\u015flev.<br \/>\n*   <code>wait (number)<\/code>: <code>func<\/code>&#8216;\u0131n \u00e7a\u011fr\u0131lmas\u0131ndan \u00f6nce beklenecek milisaniye say\u0131s\u0131.<br \/>\n*   <code>options (Object)<\/code>: \u0130ste\u011fe ba\u011fl\u0131 konfig\u00fcrasyon nesnesi.<br \/>\n    *   <code>leading (boolean)<\/code>: <code>wait<\/code> s\u00fcresinin ba\u015f\u0131nda hemen \u00e7a\u011fr\u0131lmas\u0131n\u0131 istiyorsan\u0131z <code>true<\/code>. Varsay\u0131lan <code>false<\/code>.<br \/>\n    *   <code>trailing (boolean)<\/code>: <code>wait<\/code> s\u00fcresinin sonunda \u00e7a\u011fr\u0131lmas\u0131n\u0131 istiyorsan\u0131z <code>true<\/code>. Varsay\u0131lan <code>true<\/code>.<br \/>\n    *   <code>maxWait (number)<\/code>: <code>func<\/code>&#8216;\u0131n \u00e7a\u011fr\u0131lmas\u0131ndan \u00f6nce beklenebilecek maksimum milisaniye say\u0131s\u0131. Bu, s\u00fcrekli tetiklenen bir olayda i\u015flevin asla \u00e7a\u011fr\u0131lmamas\u0131 durumunu \u00f6nler.<\/p>\n<p>\u00d6rne\u011fin, <code>leading: true<\/code> ile debouncing, olay\u0131n ilk tetiklenmesinde i\u015flevi hemen \u00e7al\u0131\u015ft\u0131r\u0131r ve ard\u0131ndan <code>wait<\/code> s\u00fcresi boyunca ba\u015fka \u00e7a\u011fr\u0131lar\u0131 g\u00f6rmezden gelir. Bu, bir butonun h\u0131zl\u0131ca birden \u00e7ok kez t\u0131klanmas\u0131n\u0131 engellemek i\u00e7in kullan\u0131labilir, ancak genellikle <code>trailing: true<\/code> (varsay\u0131lan) daha yayg\u0131nd\u0131r.<\/p>\n<h2>Throttling: Etkinlikleri K\u0131s\u0131tlama<\/h2>\n<p>Throttling, belirli bir etkinlik tetiklenirken, ilgili i\u015flevin belirli bir zaman aral\u0131\u011f\u0131nda en fazla bir kez \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131n\u0131 sa\u011flayan bir tekniktir. Amac\u0131, bir i\u015flevin \u00e7ok s\u0131k \u00e7a\u011fr\u0131lmas\u0131n\u0131 \u00f6nleyerek performans\u0131 optimize etmektir.<\/p>\n<h3>Throttling Nedir?<\/h3>\n<p>Throttling, bir i\u015flevin belirli bir s\u00fcre (\u00f6rne\u011fin 200ms) i\u00e7inde yaln\u0131zca bir kez \u00e7al\u0131\u015fmas\u0131na izin verir. Bu s\u00fcre zarf\u0131nda etkinlik ne kadar s\u0131k tetiklenirse tetiklensin, i\u015flev tekrar \u00e7al\u0131\u015ft\u0131r\u0131lmaz. S\u00fcre doldu\u011funda, i\u015flev tekrar \u00e7al\u0131\u015ft\u0131r\u0131labilir. Bu, bir araban\u0131n h\u0131z limitine uymas\u0131na veya bir \u00fcretim hatt\u0131nda belirli bir h\u0131zda \u00fcr\u00fcn \u00fcretilmesine benzer.<\/p>\n<p><strong>Analoji:<\/strong> Bir su muslu\u011funu d\u00fc\u015f\u00fcn\u00fcn. Ne kadar \u00e7evirirseniz \u00e7evirin, musluktan belirli bir saniyede akabilecek su miktar\u0131 s\u0131n\u0131rl\u0131d\u0131r. Throttling de bir i\u015flevin belirli bir zaman aral\u0131\u011f\u0131nda belirli bir s\u0131kl\u0131kta \u00e7al\u0131\u015fmas\u0131na izin verir.<\/p>\n<h3>Ne Zaman Throttling Kullan\u0131l\u0131r?<\/h3>\n<p>Throttling, genellikle bir olay\u0131n \u00e7ok s\u0131k tetiklendi\u011fi ancak her tetiklenmede an\u0131nda i\u015flem yapman\u0131n gerekmedi\u011fi veya maliyetli oldu\u011fu durumlarda tercih edilir.<br \/>\n*   <strong>Kayd\u0131rma (Scroll) Olaylar\u0131:<\/strong> Bir sayfay\u0131 kayd\u0131r\u0131rken, her piksel kayd\u0131rmas\u0131nda karma\u015f\u0131k bir animasyon veya API iste\u011fi yapmak yerine, her 100-200ms&#8217;de bir g\u00fcncelleme yapmak yeterli olabilir. Sonsuz kayd\u0131rma i\u00e7in yeni i\u00e7erik y\u00fckleme veya kayd\u0131rma konumuna g\u00f6re UI \u00f6\u011felerini g\u00fcncelleme gibi senaryolar.<br \/>\n*   <strong>Fare Hareketleri (Mousemove):<\/strong> Bir \u00e7izim uygulamas\u0131nda veya s\u00fcr\u00fckle-b\u0131rak i\u015flevinde fare konumunu her piksel hareketinde g\u00fcncellemek yerine, belirli aral\u0131klarla g\u00fcncellemek performans\u0131 art\u0131r\u0131r.<br \/>\n*   <strong>Buton T\u0131klamalar\u0131:<\/strong> Bir butona h\u0131zl\u0131ca birden \u00e7ok kez t\u0131klanmas\u0131n\u0131 \u00f6nlemek i\u00e7in, ilk t\u0131klamadan sonra belirli bir s\u00fcre (\u00f6rne\u011fin 1 saniye) boyunca ba\u015fka t\u0131klamalar\u0131n i\u015flenmesini engellemek i\u00e7in kullan\u0131labilir. Bu, \u00e7ift form g\u00f6nderimlerini \u00f6nlemede etkilidir.<br \/>\n*   <strong>API \u00c7a\u011fr\u0131lar\u0131:<\/strong> Harita konumunu g\u00fcncelleyen veya s\u00fcrekli veri ak\u0131\u015f\u0131 gerektiren durumlarda, API \u00e7a\u011fr\u0131lar\u0131n\u0131n belirli bir s\u0131kl\u0131kta yap\u0131lmas\u0131n\u0131 sa\u011flamak i\u00e7in kullan\u0131l\u0131r.<\/p>\n<h3>Lodash ile Throttling Uygulamas\u0131<\/h3>\n<p>Lodash, <code>_.throttle<\/code> i\u015flevi ile throttling uygulamas\u0131n\u0131 da son derece kolayla\u015ft\u0131r\u0131r.<\/p>\n<p><strong>\u00d6rnek 2: Kayd\u0131rma Olay\u0131n\u0131 K\u0131s\u0131tlama<\/strong><\/p>\n<pre><code class=\"language-vue\"><template>\n  <div style=\"height: 2000px; background-color: #f0f0f0;\">\n    <h2>Throttling ile Kayd\u0131rma Olay\u0131<\/h2>\n    <p>Kayd\u0131rma Konumu: {{ scrollY }}px<\/p>\n    <p>Bu metin sadece her 200ms'de bir g\u00fcncellenir.<\/p>\n    <div style=\"height: 1000px; background-color: lightblue;\">\n      A\u015fa\u011f\u0131 kayd\u0131r\u0131n\n    <\/div>\n  <\/div>\n<\/template>\n\n<script>\nimport _ from 'lodash';\n\nexport default {\n  data() {\n    return {\n      scrollY: 0,\n      throttledScroll: null,\n    };\n  },\n  mounted() {\n    \/\/ <code>mounted<\/code> ya\u015fam d\u00f6ng\u00fcs\u00fc kancas\u0131nda throttled fonksiyonu olu\u015fturun\n    \/\/ <code>this.handleScroll<\/code> metodunu 200ms aral\u0131klarla \u00e7al\u0131\u015ft\u0131racak.\n    this.throttledScroll = _.throttle(this.handleScroll.bind(this), 200);\n    \n    \/\/ Global <code>window<\/code> nesnesine etkinlik dinleyici ekle\n    window.addEventListener('scroll', this.throttledScroll);\n  },\n  methods: {\n    handleScroll() {\n      \/\/ Bu fonksiyon, kayd\u0131rma olay\u0131 ne kadar s\u0131k tetiklenirse tetiklensin,\n      \/\/ sadece her 200ms'de bir \u00e7al\u0131\u015facak.\n      this.scrollY = window.scrollY;\n      console.log('Kayd\u0131rma konumu g\u00fcncellendi:', this.scrollY);\n    },\n  },\n  beforeUnmount() {\n    \/\/ Bile\u015fen yok edilmeden \u00f6nce etkinlik dinleyiciyi kald\u0131r\u0131n\n    \/\/ Bellek s\u0131z\u0131nt\u0131lar\u0131n\u0131 \u00f6nlemek i\u00e7in kritik \u00f6neme sahiptir.\n    if (this.throttledScroll) {\n      window.removeEventListener('scroll', this.throttledScroll);\n      \/\/ Throttle fonksiyonunu da iptal edebiliriz, ancak scroll i\u00e7in genellikle gerekmez\n      \/\/ E\u011fer <code>leading: false<\/code> ve <code>trailing: true<\/code> kullan\u0131l\u0131yorsa, son \u00e7a\u011fr\u0131n\u0131n \u00e7al\u0131\u015fmas\u0131n\u0131 engelleyebilir.\n      \/\/ this.throttledScroll.cancel(); \n    }\n  },\n};\n<\/script><\/code><\/pre>\n<p><strong>A\u00e7\u0131klama:<\/strong><br \/>\n*   <code>mounted()<\/code> kancas\u0131nda <code>_.throttle(this.handleScroll.bind(this), 200)<\/code> ile <code>handleScroll<\/code> metodunu throttled hale getiriyoruz. <code>200<\/code> milisaniye, i\u015flevin en fazla bu aral\u0131kta bir kez \u00e7al\u0131\u015faca\u011f\u0131n\u0131 belirtir.<br \/>\n*   <code>window.addEventListener('scroll', this.throttledScroll)<\/code> ile throttled fonksiyonu do\u011frudan olay dinleyici olarak ba\u011fl\u0131yoruz.<br \/>\n*   <code>beforeUnmount()<\/code> kancas\u0131nda <code>window.removeEventListener('scroll', this.throttledScroll)<\/code> ile olay dinleyiciyi kald\u0131rmak, bellek s\u0131z\u0131nt\u0131lar\u0131n\u0131 ve istenmeyen davran\u0131\u015flar\u0131 \u00f6nlemek i\u00e7in hayati \u00f6neme sahiptir.<\/p>\n<p><strong><code>_.throttle<\/code> Parametreleri:<\/strong><br \/>\n*   <code>func (Function)<\/code>: Throttle uygulanacak i\u015flev.<br \/>\n*   <code>wait (number)<\/code>: <code>func<\/code>&#8216;\u0131n \u00e7a\u011fr\u0131lmas\u0131na izin verilen minimum milisaniye aral\u0131\u011f\u0131.<br \/>\n*   <code>options (Object)<\/code>: \u0130ste\u011fe ba\u011fl\u0131 konfig\u00fcrasyon nesnesi.<br \/>\n    *   <code>leading (boolean)<\/code>: <code>wait<\/code> s\u00fcresinin ba\u015f\u0131nda hemen \u00e7a\u011fr\u0131lmas\u0131n\u0131 istiyorsan\u0131z <code>true<\/code>. Varsay\u0131lan <code>true<\/code>.<br \/>\n    *   <code>trailing (boolean)<\/code>: <code>wait<\/code> s\u00fcresinin sonunda \u00e7a\u011fr\u0131lmas\u0131n\u0131 istiyorsan\u0131z <code>true<\/code>. Varsay\u0131lan <code>true<\/code>.<\/p>\n<p><code>leading: true<\/code> ve <code>trailing: true<\/code> (varsay\u0131lan de\u011ferler) ile throttling, aral\u0131\u011f\u0131n ba\u015f\u0131nda hemen bir \u00e7a\u011fr\u0131 yapar ve aral\u0131\u011f\u0131n sonunda da bir \u00e7a\u011fr\u0131 yapar, e\u011fer bu aral\u0131kta ba\u015fka \u00e7a\u011fr\u0131lar olduysa. Bu, hem an\u0131nda tepki vermeyi hem de son durumu yakalamay\u0131 sa\u011flar. E\u011fer sadece aral\u0131\u011f\u0131n ba\u015f\u0131nda \u00e7al\u0131\u015fmas\u0131n\u0131 isterseniz <code>trailing: false<\/code>, sadece sonunda \u00e7al\u0131\u015fmas\u0131n\u0131 isterseniz <code>leading: false<\/code> kullanabilirsiniz.<\/p>\n<h2>Debouncing vs. Throttling: Temel Farklar ve Ne Zaman Hangisini Se\u00e7meli<\/h2>\n<p>Debouncing ve throttling benzer ama\u00e7lara hizmet etse de, \u00e7al\u0131\u015fma \u015fekilleri ve ideal kullan\u0131m senaryolar\u0131 a\u00e7\u0131s\u0131ndan \u00f6nemli farkl\u0131l\u0131klar\u0131 vard\u0131r.<\/p>\n<p>| \u00d6zellik            | Debouncing                                 | Throttling                                     |<br \/>\n| :&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; | :&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; | :&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; |<br \/>\n| <strong>\u00c7al\u0131\u015fma Prensibi<\/strong> | Olaylar durduktan sonra bir kez \u00e7al\u0131\u015f\u0131r.   | Belirli bir zaman aral\u0131\u011f\u0131nda en fazla bir kez \u00e7al\u0131\u015f\u0131r. |<br \/>\n| <strong>Zamanlama<\/strong>      | Son olay\u0131n \u00fczerinden belirli bir s\u00fcre ge\u00e7tikten sonra. | \u0130lk olay\u0131n \u00fczerinden belirli bir s\u00fcre ge\u00e7tikten sonra (veya aral\u0131\u011f\u0131n sonunda). |<br \/>\n| <strong>Ama\u00e7<\/strong>           | Ard\u0131\u015f\u0131k olaylar\u0131 tek bir eylemde birle\u015ftirmek. | Olaylar\u0131n tetiklenme s\u0131kl\u0131\u011f\u0131n\u0131 s\u0131n\u0131rlamak.   |<br \/>\n| <strong>Kullan\u0131m Yeri<\/strong>  | Kullan\u0131c\u0131n\u0131n eylemi tamamlamas\u0131n\u0131 beklemek. | S\u00fcrekli olay ak\u0131\u015f\u0131nda d\u00fczenli g\u00fcncellemeler yapmak. |<br \/>\n| <strong>\u00d6rnek Senaryolar<\/strong> | Arama kutusu, otomatik kaydetme, form do\u011frulama, pencere boyutland\u0131rma (son hali). | Kayd\u0131rma olaylar\u0131, fare hareketleri, buton t\u0131klamalar\u0131n\u0131 engelleme, oyun girdileri. |<\/p>\n<h3>Ne Zaman Hangisini Se\u00e7meli?<\/h3>\n<p>*   <strong>Debouncing&#8217;i Se\u00e7in:<\/strong><br \/>\n    *   Kullan\u0131c\u0131n\u0131n bir dizi eylemi tamamlamas\u0131n\u0131 beklemek ve ard\u0131ndan yaln\u0131zca bir kez i\u015flem yapmak istedi\u011finizde.<br \/>\n    *   \u00d6rne\u011fin, bir arama kutusuna yazma i\u015flemi bittikten sonra API iste\u011fi g\u00f6ndermek.<br \/>\n    *   Form alanlar\u0131na veri giri\u015fi durduktan sonra do\u011frulama yapmak.<br \/>\n    *   Bir metin d\u00fczenleyicide kullan\u0131c\u0131 durduktan sonra otomatik kaydetme yapmak.<br \/>\n    *   Pencere boyutland\u0131rma i\u015flemi tamamland\u0131ktan sonra d\u00fczeni yeniden hesaplamak.<br \/>\n*   <strong>Throttling&#8217;i Se\u00e7in:<\/strong><br \/>\n    *   Bir i\u015flevin belirli bir zaman aral\u0131\u011f\u0131nda \u00e7ok s\u0131k \u00e7al\u0131\u015fmas\u0131n\u0131 engellemek ve d\u00fczenli aral\u0131klarla g\u00fcncelleme yapmak istedi\u011finizde.<br \/>\n    *   \u00d6rne\u011fin, kayd\u0131rma s\u0131ras\u0131nda paralaks efektlerini veya sonsuz kayd\u0131rmay\u0131 her 100ms&#8217;de bir g\u00fcncellemek.<br \/>\n    *   Fare hareketlerini izlerken her 50ms&#8217;de bir konum g\u00fcncellemesi yapmak.<br \/>\n    *   Bir butona h\u0131zl\u0131ca birden \u00e7ok kez t\u0131klanmas\u0131n\u0131 engellemek (\u00f6rne\u011fin, her 1 saniyede bir t\u0131klamaya izin vermek).<br \/>\n    *   Oyunlarda h\u0131zl\u0131 ate\u015f etme veya s\u00fcrekli yetenek kullanma gibi durumlarda bir &#8220;cooldown&#8221; (bekleme s\u00fcresi) uygulamak.<\/p>\n<p>Her iki teknik de performans\u0131 ve kullan\u0131c\u0131 deneyimini iyile\u015ftirmek i\u00e7in g\u00fc\u00e7l\u00fc ara\u00e7lard\u0131r, ancak do\u011fru senaryo i\u00e7in do\u011fru tekni\u011fi se\u00e7mek \u00f6nemlidir.<\/p>\n<h2>Geli\u015fmi\u015f Hususlar ve En \u0130yi Uygulamalar<\/h2>\n<p>Throttling ve debouncing&#8217;i Vue.js uygulamalar\u0131n\u0131za entegre ederken g\u00f6z \u00f6n\u00fcnde bulundurman\u0131z gereken baz\u0131 ek noktalar ve en iyi uygulamalar vard\u0131r.<\/p>\n<h3>Ya\u015fam D\u00f6ng\u00fcs\u00fc Kancalar\u0131 ve Temizleme<\/h3>\n<p>Yukar\u0131daki \u00f6rneklerde de g\u00f6r\u00fcld\u00fc\u011f\u00fc gibi, debounced veya throttled fonksiyonlar\u0131 olu\u015fturmak ve temizlemek i\u00e7in Vue.js ya\u015fam d\u00f6ng\u00fcs\u00fc kancalar\u0131n\u0131 do\u011fru kullanmak hayati \u00f6neme sahiptir:<br \/>\n*   <strong>Olu\u015fturma (<code>created<\/code> veya <code>mounted<\/code>):<\/strong> Debounced\/throttled fonksiyonlar\u0131n\u0131z\u0131 genellikle <code>created<\/code> veya <code>mounted<\/code> kancalar\u0131nda tan\u0131mlamal\u0131s\u0131n\u0131z.<br \/>\n    *   <code>created<\/code>: Bile\u015fen olu\u015fturuldu\u011funda, veri reaktivitesi kurulmadan \u00f6nce. Bu, fonksiyonu bir <code>data<\/code> \u00f6zelli\u011fine atamak i\u00e7in iyidir.<br \/>\n    *   <code>mounted<\/code>: Bile\u015fen DOM&#8217;a eklendikten sonra. Bu, global etkinlik dinleyicileri (\u00f6rn. <code>window.addEventListener<\/code>) eklemek i\u00e7in daha uygundur.<br \/>\n*   <strong>Temizleme (<code>beforeUnmount<\/code> \/ <code>beforeDestroy<\/code>):<\/strong> Bile\u015fen DOM&#8217;dan kald\u0131r\u0131lmadan \u00f6nce (<code>beforeUnmount<\/code> Vue 3&#8217;te, <code>beforeDestroy<\/code> Vue 2&#8217;de), olu\u015fturdu\u011funuz debounced\/throttled fonksiyonlar\u0131n\u0131 ve ekledi\u011finiz etkinlik dinleyicilerini temizlemeyi unutmay\u0131n.<br \/>\n    *   <code>_.debounce<\/code> ve <code>_.throttle<\/code> taraf\u0131ndan d\u00f6nd\u00fcr\u00fclen fonksiyonlar\u0131n bir <code>cancel()<\/code> metodu vard\u0131r. Bu metodu \u00e7a\u011f\u0131rmak, bekleyen \u00e7a\u011fr\u0131lar\u0131 iptal eder. Bu, \u00f6zellikle debounced fonksiyonlar i\u00e7in \u00f6nemlidir, \u00e7\u00fcnk\u00fc bile\u015fen yok edilse bile bir \u00e7a\u011fr\u0131 beklemeye devam edebilir ve bu durum bellek s\u0131z\u0131nt\u0131lar\u0131na veya hatalara yol a\u00e7abilir.<br \/>\n    *   <code>window.removeEventListener()<\/code> gibi \u00e7a\u011fr\u0131larla manuel olarak ekledi\u011finiz t\u00fcm etkinlik dinleyicilerini kald\u0131rmal\u0131s\u0131n\u0131z.<\/p>\n<pre><code class=\"language-javascript\">\/\/ \u00d6rnek temizleme\nbeforeUnmount() { \/\/ Vue 3\n  if (this.debouncedSearch) {\n    this.debouncedSearch.cancel(); \/\/ Bekleyen debounced \u00e7a\u011fr\u0131s\u0131n\u0131 iptal et\n  }\n  if (this.throttledScroll) {\n    window.removeEventListener('scroll', this.throttledScroll); \/\/ Etkinlik dinleyiciyi kald\u0131r\n  }\n}\n\/\/ Vue 2 i\u00e7in beforeDestroy kullan\u0131n.<\/code><\/pre>\n<h3><code>this<\/code> Ba\u011flam\u0131 Sorunu<\/h3>\n<p>Bir Vue.js metodunu <code>_.debounce<\/code> veya <code>_.throttle<\/code> ile sarmalad\u0131\u011f\u0131n\u0131zda, <code>this<\/code> ba\u011flam\u0131n\u0131n kaybolma riski vard\u0131r. Bu, sar\u0131lm\u0131\u015f fonksiyon i\u00e7inde <code>this<\/code>&#8216;in Vue bile\u015fen \u00f6rne\u011fine de\u011fil, <code>window<\/code> veya <code>undefined<\/code> gibi farkl\u0131 bir de\u011fere i\u015faret etmesine neden olabilir. Bu sorunu \u00e7\u00f6zmek i\u00e7in iki yayg\u0131n y\u00f6ntem vard\u0131r:<br \/>\n*   <strong><code>Function.prototype.bind()<\/code> Kullan\u0131m\u0131:<\/strong><\/p>\n<pre><code class=\"language-javascript\">this.debouncedMethod = _.debounce(this.myMethod.bind(this), 300);<\/code><\/pre>\n<p>    Bu, <code>myMethod<\/code> i\u00e7indeki <code>this<\/code>&#8216;in her zaman Vue bile\u015fen \u00f6rne\u011fine i\u015faret etmesini sa\u011flar.<br \/>\n*   <strong>Ok Fonksiyonlar\u0131 (Arrow Functions):<\/strong><\/p>\n<pre><code class=\"language-javascript\">this.debouncedMethod = _.debounce(() => this.myMethod(), 300);<\/code><\/pre>\n<p>    Ok fonksiyonlar\u0131 kendi <code>this<\/code> ba\u011flam\u0131na sahip olmad\u0131klar\u0131 i\u00e7in, tan\u0131mland\u0131klar\u0131 kapsamdaki <code>this<\/code>&#8216;i (yani Vue bile\u015fen \u00f6rne\u011fini) miras al\u0131rlar.<\/p>\n<h3>Lodash&#8217;in Performans Etkisi ve Boyutu<\/h3>\n<p>Lodash, olduk\u00e7a optimize edilmi\u015f ve yayg\u0131n olarak kullan\u0131lan bir k\u00fct\u00fcphanedir. Ancak, projenize t\u00fcm Lodash k\u00fct\u00fcphanesini dahil etmek, \u00f6zellikle sadece <code>debounce<\/code> ve <code>throttle<\/code> gibi birka\u00e7 fonksiyona ihtiyac\u0131n\u0131z varsa, bundle boyutunuzu gereksiz yere art\u0131rabilir.<br \/>\n*   <strong>Mod\u00fcler \u0130\u00e7e Aktarma:<\/strong> Sadece ihtiyac\u0131n\u0131z olan Lodash fonksiyonlar\u0131n\u0131 i\u00e7e aktararak bundle boyutunu optimize edebilirsiniz:<\/p>\n<pre><code class=\"language-javascript\">import debounce from 'lodash\/debounce';\n    import throttle from 'lodash\/throttle';\n\n    \/\/ ... kullan\u0131rken debounce(func, wait) veya throttle(func, wait)<\/code><\/pre>\n<p>    Bu y\u00f6ntem, webpack veya Rollup gibi modern bundler&#8217;lar taraf\u0131ndan otomatik olarak &#8220;tree-shaking&#8221; (kullan\u0131lmayan kodlar\u0131 eleme) yap\u0131lmas\u0131na yard\u0131mc\u0131 olur.<br \/>\n*   <strong>lodash-es:<\/strong> ES mod\u00fcl\u00fc uyumlu bir Lodash versiyonu olan <code>lodash-es<\/code> de ayn\u0131 ama\u00e7la kullan\u0131labilir ve tree-shaking i\u00e7in daha iyi optimizasyon sa\u011flayabilir.<\/p>\n<h3>Test Etme<\/h3>\n<p>Debounced veya throttled fonksiyonlar\u0131 test etmek, zaman bazl\u0131 olduklar\u0131 i\u00e7in biraz \u00f6zel bir yakla\u015f\u0131m gerektirir. Jest gibi test \u00e7er\u00e7eveleri, zamanlay\u0131c\u0131lar\u0131 kontrol etmenize olanak tan\u0131yan ara\u00e7lar sunar:<\/p>\n<pre><code class=\"language-javascript\">\/\/ Jest ile debounced fonksiyonu test etme \u00f6rne\u011fi\nimport _ from 'lodash';\n\ndescribe('debounced function', () => {\n  jest.useFakeTimers(); \/\/ Sahte zamanlay\u0131c\u0131lar\u0131 kullan\n\n  it('should call the function only after the debounce time', () => {\n    const mockFn = jest.fn();\n    const debouncedFn = _.debounce(mockFn, 1000);\n\n    debouncedFn();\n    debouncedFn();\n    debouncedFn();\n\n    \/\/ Zaman ge\u00e7medi\u011fi i\u00e7in hen\u00fcz \u00e7a\u011fr\u0131lmamal\u0131\n    expect(mockFn).not.toHaveBeenCalled();\n\n    jest.advanceTimersByTime(500); \/\/ 500ms ileri sar\n    expect(mockFn).not.toHaveBeenCalled(); \/\/ Hala 1000ms dolmad\u0131\n\n    jest.advanceTimersByTime(500); \/\/ 500ms daha ileri sar (toplam 1000ms)\n    expect(mockFn).toHaveBeenCalledTimes(1); \/\/ \u015eimdi \u00e7a\u011fr\u0131lm\u0131\u015f olmal\u0131\n  });\n});<\/code><\/pre>\n<h3>Kullan\u0131c\u0131 Deneyimi (UX) \u0130pu\u00e7lar\u0131<\/h3>\n<p>Debouncing ve throttling, performans\u0131 art\u0131r\u0131rken, kullan\u0131c\u0131n\u0131n eylemlerine an\u0131nda tepki verilmedi\u011fi anlam\u0131na da gelir. Bu nedenle, kullan\u0131c\u0131ya geri bildirim sa\u011flamak \u00f6nemlidir:<br \/>\n*   <strong>Y\u00fckleme Durumlar\u0131:<\/strong> Arama \u00e7ubu\u011fu \u00f6rne\u011finde oldu\u011fu gibi, bir API iste\u011fi debounced oldu\u011funda, kullan\u0131c\u0131n\u0131n bekledi\u011fini bildiren bir y\u00fckleme g\u00f6stergesi (spinner) veya metin (<code>Aran\u0131yor...<\/code>) g\u00f6sterebilirsiniz.<br \/>\n*   <strong>G\u00f6rsel Geri Bildirim:<\/strong> Bir buton throttled oldu\u011funda, d\u00fc\u011fmenin t\u0131klanamaz hale geldi\u011fini (disabled) veya bir bekleme s\u00fcresi g\u00f6sterdi\u011fini belirten g\u00f6rsel ipu\u00e7lar\u0131 sa\u011flayabilirsiniz.<br \/>\n*   <strong>Minimum Gecikme S\u00fcreleri:<\/strong> Debounce veya throttle i\u00e7in \u00e7ok uzun s\u00fcreler se\u00e7mek, kullan\u0131c\u0131y\u0131 rahats\u0131z edebilir. Genellikle 200ms ile 500ms aras\u0131ndaki de\u011ferler \u00e7o\u011fu senaryo i\u00e7in iyi bir denge sa\u011flar.<\/p>\n<h3>Alternatifler<\/h3>\n<p>Lodash kullanmak genellikle en kolay ve en sa\u011flam y\u00f6ntem olsa da, bu teknikleri manuel olarak da uygulayabilirsiniz:<br \/>\n*   <strong>Manuel Debouncing:<\/strong> <code>setTimeout<\/code> ve <code>clearTimeout<\/code> kullanarak kendi debounce i\u015flevinizi yazabilirsiniz.<\/p>\n<pre><code class=\"language-javascript\">let timeoutId;\n    function myDebouncedFunction() {\n      clearTimeout(timeoutId);\n      timeoutId = setTimeout(() => {\n        \/\/ \u0130\u015flevi \u00e7al\u0131\u015ft\u0131r\n      }, 300);\n    }<\/code><\/pre>\n<p>*   <strong>Manuel Throttling:<\/strong> Bir zamanlay\u0131c\u0131 ve bir bayrak (flag) kullanarak kendi throttle i\u015flevinizi yazabilirsiniz.<\/p>\n<pre><code class=\"language-javascript\">let throttleTimeout;\n    let canCall = true;\n    function myThrottledFunction() {\n      if (!canCall) return;\n      canCall = false;\n      \/\/ \u0130\u015flevi \u00e7al\u0131\u015ft\u0131r\n      throttleTimeout = setTimeout(() => {\n        canCall = true;\n      }, 200);\n    }<\/code><\/pre>\n<p>Bu manuel uygulamalar, \u00f6zellikle k\u00fc\u00e7\u00fck projelerde veya k\u00fct\u00fcphane ba\u011f\u0131ml\u0131l\u0131\u011f\u0131 eklemek istemedi\u011finizde faydal\u0131 olabilir. Ancak Lodash, bu i\u015flevleri daha sa\u011flam, test edilmi\u015f ve ek se\u00e7eneklerle (leading\/trailing \u00e7a\u011fr\u0131lar, <code>maxWait<\/code>) sunar, bu da \u00e7o\u011fu durumda tercih edilmesini sa\u011flar.<\/p>\n<h2>Sonu\u00e7<\/h2>\n<p>Web uygulamalar\u0131nda etkinlik y\u00f6netimi, y\u00fcksek performansl\u0131 ve kullan\u0131c\u0131 dostu aray\u00fczler olu\u015fturman\u0131n temel ta\u015flar\u0131ndan biridir. Throttling ve debouncing, bu etkinlikleri ak\u0131ll\u0131ca ele alarak uygulaman\u0131z\u0131n gereksiz yere kaynak t\u00fcketmesini engeller, CPU ve bellek kullan\u0131m\u0131n\u0131 optimize eder ve a\u011f trafi\u011fini azalt\u0131r. Bu sayede, kullan\u0131c\u0131lar daha ak\u0131c\u0131, h\u0131zl\u0131 ve tepkisel bir deneyim ya\u015farlar.<\/p>\n<p>Bu makalede, debouncing ve throttling&#8217;in ne oldu\u011funu, ne zaman kullan\u0131lmalar\u0131 gerekti\u011fini ve Vue.js ortam\u0131nda Lodash k\u00fct\u00fcphanesi ile nas\u0131l etkin bir \u015fekilde uygulanabileceklerini detayl\u0131 \u00f6rneklerle ele ald\u0131k. \u00d6zellikle <code>created<\/code> ve <code>mounted<\/code> gibi ya\u015fam d\u00f6ng\u00fcs\u00fc kancalar\u0131nda fonksiyonlar\u0131 olu\u015fturman\u0131n, <code>beforeUnmount<\/code> (veya <code>beforeDestroy<\/code>) kancas\u0131nda ise bekleyen \u00e7a\u011fr\u0131lar\u0131 iptal etmenin ve etkinlik dinleyicilerini kald\u0131rman\u0131n \u00f6nemini vurgulad\u0131k. Ayr\u0131ca, <code>this<\/code> ba\u011flam\u0131n\u0131n do\u011fru bir \u015fekilde korunmas\u0131, Lodash&#8217;in mod\u00fcler i\u00e7e aktar\u0131m\u0131 ve kullan\u0131c\u0131ya geri bildirim sa\u011flaman\u0131n \u00f6nemi gibi en iyi uygulamalara de\u011findik.<\/p>\n<p>Vue.js&#8217;in reaktif do\u011fas\u0131 ve Lodash&#8217;in g\u00fc\u00e7l\u00fc yard\u0131mc\u0131 programlar\u0131 bir araya geldi\u011finde, geli\u015ftiricilere karma\u015f\u0131k etkinlik y\u00f6netimi senaryolar\u0131n\u0131 kolayca \u00e7\u00f6zme yetene\u011fi sunar. Bu teknikleri ustaca kullanarak, uygulamalar\u0131n\u0131z\u0131n sadece i\u015flevsel de\u011fil, ayn\u0131 zamanda performansl\u0131 ve keyifli olmas\u0131n\u0131 sa\u011flayabilirsiniz. Modern web geli\u015ftirme d\u00fcnyas\u0131nda, bu bilgi ve beceriler, her geli\u015ftiricinin ara\u00e7 kutusunda bulunmas\u0131 gereken vazge\u00e7ilmez unsurlard\u0131r.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi\nGiri\u015f\nModern web uygulamalar\u0131, kullan\u0131c\u0131 etkile\u015fimini art\u0131rmak ve zengin bir","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1402],"tags":[],"class_list":{"0":"post-38336","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-vue","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/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:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi\" \/>\n<meta property=\"og:description\" content=\"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi Giri\u015f Modern web uygulamalar\u0131, kullan\u0131c\u0131 etkile\u015fimini art\u0131rmak ve zengin bir\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-29T03:40:49+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi\",\"datePublished\":\"2026-01-29T03:40:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\"},\"wordCount\":3225,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Vue\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#respond\"]}],\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\",\"name\":\"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2026-01-29T03:40:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","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:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/","og_locale":"tr_TR","og_type":"article","og_title":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi","og_description":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi Giri\u015f Modern web uygulamalar\u0131, kullan\u0131c\u0131 etkile\u015fimini art\u0131rmak ve zengin bir","og_url":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2026-01-29T03:40:49+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"18 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi","datePublished":"2026-01-29T03:40:49+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/"},"wordCount":3225,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Vue"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#respond"]}],"copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/","url":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/","name":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2026-01-29T03:40:49+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/throttling-ve-debouncing-vue-js-ve-lodash-ile-etkinlik-yonetimi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Throttling ve Debouncing: Vue.js ve Lodash ile Etkinlik Y\u00f6netimi"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/38336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=38336"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/38336\/revisions"}],"predecessor-version":[{"id":38337,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/38336\/revisions\/38337"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=38336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=38336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=38336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}