Comment by jiehong
6 months ago
In electronics, I think we'd use a latch, so it switches high, and stays high despite input change.
Doesn't really apply to a search box, where it's more of a delayed event if no event during a specific time window, only keeping last event.
Switches usually open after closing, so your latch arrangement has to figure out how to unlatch.
At which point you are doing debouncing: distinguishing an intentional switch opening from the bounce that continued after you latched. You need some hold-off time or something.
Also, switches contacts bounce when opening!
A latch could be great for some kind of panic button which indicates a state change that continues to be asserted when the switch opens (and is reset in some other way).
> In electronics, I think we'd use a latch, so it switches high, and stays high despite input change.
RC circuits are more typical, you want to filter out high frequency pulses (indicative of bouncing) and only keep the settled/steady state signal. A latch would be too eager I think.