Using RxJS to improve button press handling in Node.js
-
I've been using Flic buttons for 2-3 months now and one thing that's irked me is the lack of other click types and not to mention the slow 1 second debounce timer on the press-and-hold action.
Instead of begging the Flic devs to change this just for me, I hooked into the Flic SDK's
buttonUpOrDown
event and used observables to add in an infinite amount of press types such as double-press-and-hold and triple-press. That plus the new configurable 300ms debounce on all actions completely changed the responsiveness of the buttons. No longer do I accidentally trigger a press action when I mean to press-and-hold because I didn't hold it down long enough. My wife's also pleased with the speediness. She doesn't accidentally turn the lights on then off because the button timeout took too long.You can read more about the actual implementation here if you're curious:
RxJS and the Observable Flic Button:
https://medium.com/@Sawtaytoes/flic-buttons-and-the-observable-customization-using-rxjs-2214bc53d407