Open 2x2xplz opened 8 years ago
+1 for this type of functionality -- I also have had to fork out to create something similar but some core support for exposing the captures that exercised the event just makes sense given the regex functionality.
Not sure I think the stringified result in this patch is the best option but given a choice between this or nothing this is better. =)
Tracks key press history and adds a
keySequence
object to the finalevent
(which is already sent to triggered function). Useful when using multiple-choice or regex-like syntax. i.e. get the actual 3-digit code that triggeredshift+;,[0-9],[0-9],[0-9]
. keySequence is an object that contains an object per key press, and also a string representation calledsequence
using pipes to separate keys:shift+h|e|l|l|o|space|ctrl+w|o|r|l|d
example usage:
jwerty has tremendous potential because of regex support, which other libraries do not have. However its overall support for sequences is spotty, for example, (on Chrome 51/Windows at least) sequences which end in a modifier like
a,b,shift+c
do not trigger. Some regex edge cases are also unsupported:[a-z],[a-z],[a-z],enter
will not be triggered by abcd-enter (I would expect bcd-enter to be the match). Still, the support it does have is great and along with ajax requests, allows for simple password-type sequences that can't be revealed with View Source. I really hope you'll revisit this library and finish 0.4. Thanks.