Questions tagged [debouncing]

Debouncing ensures that a handler is not executed too often for an event that may be happening several times per second.

698 questions
508
votes
27 answers

Difference Between throttling and debouncing a function

Can anyone give me a in-simple-words explanation about the difference between throttling and debouncing a function for rate-limiting purposes. To me both seems to do the same the thing. I have checked these two blogs to find out…
bhavya_w
  • 9,186
  • 9
  • 29
  • 38
229
votes
18 answers

How to implement debounce in Vue2?

I have a simple input box in a Vue template and I would like to use debounce more or less like this: However the debounce property has been deprecated in Vue 2. The recommendation only says:…
MartinTeeVarga
  • 10,478
  • 12
  • 61
  • 98
195
votes
12 answers

What is the "debounce" function in JavaScript?

I am interested in the "debouncing" function in JavaScript, at JavaScript Debounce Function. Unfortunately the code is not explained clearly enough for me to understand. How does it work (I left my comments below)? In short, I just really do not…
Startec
  • 12,496
  • 23
  • 93
  • 160
112
votes
13 answers

How to debounce Textfield onChange in Dart?

I'm trying to develop a TextField that update the data on a Firestore database when they change. It seems to work but I need to prevent the onChange event to fire multiple times. In JS I would use lodash _debounce() but in Dart I don't know how to…
DxW
  • 1,414
  • 3
  • 11
  • 23
98
votes
15 answers

How to add debounce time to an async validator in angular 2?

This is my Async Validator it doesn't have a debounce time, how can I add it? static emailExist(_signupService:SignupService) { return (control:Control) => { return new Promise((resolve, reject) => { …
Chanlito
  • 2,322
  • 2
  • 17
  • 27
91
votes
13 answers

How to trigger an event in input text after I stop typing/writing?

I want to trigger an event just after I stop typing (not while typing) characters in my input textbox. I've tried with: $('input#username').keypress(function() { var _this = $(this); // copy of this object for further usage …
user1386320
78
votes
15 answers

Flutter TextField value always uppercase & debounce

I am new in Flutter. I am looking for TextField value to always uppercase but I did not find any resource on that. Another issue is the TextField onChanged event debounce implementation. When I type on TextField it immediately fires onChanged event…
Harun
  • 1,137
  • 1
  • 9
  • 7
55
votes
21 answers

C# event debounce

I'm listening to a hardware event message, but I need to debounce it to avoid too many queries. This is an hardware event that sends the machine status and I have to store it in a database for statistical purposes, and it sometimes happens that its…
Tobia
  • 9,165
  • 28
  • 114
  • 219
51
votes
5 answers

Problems with debounce in useEffect

I have a form with username input and I am trying to verify if the username is in use or not in a debounce function. The issue I'm having is that my debounce doesn't seem to be working as when I type "user" my console looks like u us use user Here…
Ryne
  • 1,195
  • 2
  • 14
  • 32
50
votes
4 answers

lodash debounce in React functional component not working

I have a functional component built around the React Table component that uses the Apollo GraphQL client for server-side pagination and searching. I am trying to implement debouncing for the searching so that only one query is executed against the…
jrkt
  • 2,615
  • 5
  • 28
  • 48
46
votes
13 answers

Lodash debounce with React Input

I'm trying to add debouncing with lodash to a search function, called from an input onChange event. The code below generates a type error 'function is expected', which I understand because lodash is expecting a function. What is the right way to do…
Michael Kaufman
  • 683
  • 1
  • 9
  • 19
45
votes
5 answers

Lodash debounce not working in React

it would be best to first look at my code: import React, { Component } from 'react'; import _ from 'lodash'; import Services from 'Services'; // Webservice calls export default class componentName extends Component { constructor(props) { …
user818700
38
votes
2 answers

Debounce function in jQuery

I'm attempting to debounce a button's input using the jquery debouncing library by Ben Alman. http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/ Currently this is the code that I have. function foo() { console.log("It…
Gunther
  • 2,474
  • 4
  • 31
  • 45
31
votes
8 answers

Jest unit test for a debounce function

I am trying to write a unit test for a debounce function. I'm having a hard time thinking about it. This is the code: function debouncer(func, wait, immediate) { let timeout; return (...args) => { clearTimeout(timeout); timeout =…
RecipeCreator
  • 323
  • 1
  • 5
  • 10
28
votes
2 answers

Vuetify : throttle / debounce v-autocomplete

I'm using the Vuetify Autocomplete with remote data, and I would like to to throttle / debounce the API calls (wait 500 ms to call the API when the user is typing text in the autocomplete). How can I do that? I saw a Stack OverFlow post about the…
Ricou
  • 946
  • 3
  • 11
  • 22
1
2 3
46 47