Giter VIP home page Giter VIP logo

key-controller's People

Contributors

philipjscott avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

key-controller's Issues

Add support for compound keybindings

What happened:

The following snippet does not work:

const controls = {
  inc: 'alt+b'
}

What you expected to happen:

Virtual keys should be able to map to compound keybindings

Support case-sensitive controls

Users should not need to need to manually check e.shiftKey; they should be able to put case-sensitive characters in the controls.

Consider scraping karma testing and just mock KeyboardEvent?

Describe the bug

The karma configuration is overly complicated (need to do a babel transform, then a browserify transform, then hook it up to istanbul). Not only that, but there's some buggy behaviour when running the tests in headless chrome (eg. https://github.com/ScottyFillups/key-controller/blob/master/test/controller.test.js#L28).

However, the most jarring problem is that the coverage reports returned from karma don't make any sense; why is it complaining that comments aren't being hit (https://coveralls.io/builds/19758335/source?filename=lib/controller.js)? Perhaps it would make more sense to just mock out the DOM and use Ava?

Simplify README

Describe the bug
The README concepts section is too wordy, and the usage section's example is too large in scope.

Expected behavior
The usage and concepts section should be simple, and you should go more in-depth in an API section.

Change API to avoid having to declaring model repeatedly

Consider:

const virtuals = (obj1, obj2, e) => ({
  next () {
    obj1.foo()
  },
  bar: {
    keyup () {
      obj2.bar()
    },
    keydown () {
      obj1.eee(e)
    }
  }
})

export default virtuals

If a virtual is a function rather than an object containing keyup and/or keydown, then it's assumed that the function should be applied on keydown (a shorthand). Multiple models will be allowed, and the keyboard event will be passed as the last parameter.

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.