Skip to content
Prompt Words
History

Debounce

Also called: debouncing, wait until typing stops, input delay.

Wait until something has stopped happening for a short time, then act once. A search box with a 300 ms debounce sends one request after you stop typing, instead of one for every key.

Type in the box, or press the button. With debounce on, the search waits until you stop typing for 300 ms and sends one request instead of one per key.

Type to search

Idle

Say it in a prompt

Debounce the product search box by 300 ms so GET /api/search?q= is only called after the user stops typing for 300 ms. Skip queries shorter than 2 characters, and cancel the previous request so an old answer never replaces a newer one.

Seen on

  • Lodash: _.debounce delays a function until a set number of milliseconds have passed since it was last called, with leading, trailing and maxWait options.

You might describe it as

  • search that waits until I stop typing
  • don't send a request for every key I press
  • wait a moment after the last keystroke, then search

Not to be confused with

  • Throttle

    Debounce waits for a pause and fires once at the end; throttle keeps firing, but at most once per interval.