Giter Site home page Giter Site logo

Comments (3)

RobertWHurst avatar RobertWHurst commented on September 8, 2024 1

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.

RobertWHurst avatar RobertWHurst commented on September 8, 2024

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.

RobertWHurst avatar RobertWHurst commented on September 8, 2024

Closing as checkKeyComboSequenceIndex was landed in v1.1.0. That said we can continue with this discussion still.

from keystrokes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.