keyconfig
stores keyboard shortcut definitions
Last updated 5 years ago by tetsuo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install keyconfig 
SYNC missed versions from official npm registry.

keyconfig

stores keyboard shortcut definitions.

usage

var keyconfig = new Keyconfig({
  x: [ 
    { 
      name: 'foo', 
      binding: [ [ 'ctrl+z' ], [ 'command+z' ] ]
    } 
  ]
});

keyconfig
  .on('change', function (collection, model) { });
  .find({ name: 'x '})
  .find({ name: 'foo' })
  .update({ binding: ['command+d'] });

spec

Below is an example of a collection:

{
  "editor":
  [
    {
      "name": "save",
      "description": "Save",
      "binding": [
        [ "ctrl+s" ],
        [ "command+s" ]
      ],
      "options": {
        "enabled": true
      }
    }
  ]
}

### fields

  • name must be unique
  • binding is an array of two arrays that defines win and mac shortcuts respectively
  • description is description text
  • options is always extended when you do update

api

keyconfig(collections={})

Collection(name, models=[])

.add(model)

.update(name, value={}, silent=false)

.toJSON()

.getCollidingWin()

.getCollidingMac()

Keyconfig and Collection instances also proxy underscore methods.

Model(value={})

.update(value={}, silent=false)

.getWinKeys()

.getMacKeys()

.getWinChecksum()

.getMacChecksum()

.toJSON()

Updating a model triggers a change event that bubble up.

license

mit

Current Tags

  • 0.7.2                                ...           latest (5 years ago)

14 Versions

  • 0.7.2                                ...           5 years ago
  • 0.7.1                                ...           5 years ago
  • 0.7.0                                ...           5 years ago
  • 0.6.1                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.2                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |