stores keyboard shortcut definitions
npm install @koding/keyconfigstores keyboard shortcut definitions.
``js
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'] });
`
Below is an example of a collection:
`json`
{
"editor":
[
{
"name": "save",
"description": "Save",
"binding": [
[ "ctrl+s" ],
[ "command+s" ]
],
"options": {
"enabled": true
}
}
]
}
### fields
- name must be uniquebinding
- is an array of two arrays that defines win and mac shortcuts respectivelydescription
- is description textoptions
- is always extended when you do update
Keyconfig and Collection instances also proxy underscore methods.
Updating a model triggers a change` event that bubble up.
mit