|
|
|
|
|
by STRML
4592 days ago
|
|
As other comments have pointed out, `_.debounce` is the correct answer. Here's the bit from the docs that always reminds me when to use `_.debounce` over throttle: _.debounce: [...] Useful for implementing behavior that
should only happen after the input has stopped arriving.
http://underscorejs.org/#debounce |
|
Right after your quote, the docs add: "For example: rendering a preview of a Markdown comment, recalculating a layout after the window has stopped being resized..." These operations can both be very expensive on the client side — layout is slow — and can also distract the user if they make stuff jump around on the page. The downsides of doing these updates too often are more clear than for a simple autocomplete.