What’s a good approach to trying to capture keyboard input from a barcode scanner in the form of !99999999999999\n ? is re-pressed able to dispatch an event with a variable sequence? It will be attached to 1 page but I’d rather not require the user to focus on a textfield to use the barcode scanner
(I can also adjust the prefix character and end character)
Re-pressed only allows you to dispatch events that set up listeners for keyboard events. You don't have a mechanism to send keyboard events to re-pressed. https://github.com/gadfly361/re-pressed/blob/master/src%2Fmain%2Fre_pressed%2Fimpl.cljs#L149-L151
That’s fine, It’s listening to them, I can see it fire events for the !99999…99\n just fine, I just can’t figure out the syntax to get it to fire an event
In the readme look for
[{:keyCode 9} {:keyCode 9}]
I think you'll want to do something like that but with whatever sequence of keys you're expectingAnd by something like that, I just mean putting the maps in an array like that, so then it'll match after that exact sequence (whatever you choose it to be)
Ok so far so good.. I’m looking at that. Is there a way to specify a variable set of keys to capture between the ! and the \n? google AI thought there was but it looks like it might just be making stuff up again. something like [{:keycode 45 :shiftKey true} XXXXXXXXX {:keycode 13}]
Ah I understand now. No, that use case, where known keys sandwich unknown keys is not supported
You can only handle a sequence of known keys
Thanks
Np