Comments (3)
Yeah that sounds like a great idea. Let me mull on this a bit and circle around with you in a day or so. Glad to hear you like the library 🍻
from keystrokes.
Well it's been more than a day or so 😅.
I've been thinking about how to do this and I think I'm going to add a new method to keystrokes called checkKeyComboSequenceIndex
. It will return the sequence index of the combo - 0 if the combo is not active at all. For each sequence active within the combo the returned value will be incremented. So for a combo like g,o
if g
is pressed then the returned index will be 1
. If then g
is released and o
is pressed the index will be 2
. Once o
is released the index will be 0
again.
If get a string representation of what parts of the combo are pressed simply use string split
const myCombo = 'g,o'
const myComboSquenceIndex = keystrokes.checkKeyComboSequenceIndex(myCombo)
const activePartOfCombo = myCombo.split(',').slice(0, myComboSequenceIndex).join(',')
from keystrokes.
Closing as checkKeyComboSequenceIndex
was landed in v1.1.0. That said we can continue with this discussion still.
from keystrokes.
Related Issues (20)
- Cancel key combo when switching to a different window HOT 3
- Failed to resolve entry for package "@rwh/vue-keystrokes" HOT 2
- `keyup` listener HOT 4
- `preventDefault` seems to have no effect HOT 11
- Odd behaviour with Control/Command key on Mac HOT 4
- Gmail style key combinations allow other keys HOT 4
- bindKey and bindKeyCombo support array combination HOT 2
- Unable to type Shift + "+" combination HOT 2
- Unable to import Keystrokes class HOT 1
- How to disable keystrokes when focus on input, textarea, select? HOT 3
- The test instance of keystrokes does not implement the interface of browser binding sourced events
- Create bindings using KeyboardEvent#code value HOT 3
- `useKeyCombo` from `@rwh/react-keystrokes` does not work in version 1.5.* HOT 3
- Fire multiple events when pressing combo without releasing all keys HOT 1
- Cannot use key aliases with bindKey or checkKey HOT 1
- Arrow keys not detected with checkKey HOT 1
- Separately bound keys are not firing together HOT 1
- expose preventDefault in react hook
- Way to unbindAll or destroy the instance?
- Google Autofill bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keystrokes.