4 ms·
Right, from a UX perspective, throttle makes more sense due to more constant feedback. You want the user to realize that it is a live search before they finish
by thedz 13y ago
Right, from a UX perspective, throttle makes more sense due to more constant feedback. You want the user to realize that it is a live search before they finish typing. Else, they'll just type the entire query.
But obviously, in this case, the interviewer specifically outlined requirements that would make debounce the better choice than throttle.
- mercer 13y agoGood point. I've generally used debounce for live search, and throttle for window resizing, among other things. In hindsight throttle is perhaps better for live search as well.
- thedz 13y agoFor window resizing, i'd actually use debounce. Most times, a user resizes a window with a predetermined size in mind -- they want to show something behind the window, or want to make the window fill an existing space. In that case, showing live updates in the window during resizing might not be worth it.