Expose minimal interface for viewing keymap

This commit is contained in:
Matt Colyer
2013-09-24 17:06:05 -07:00
parent bec93ed092
commit 8eeca35c85
2 changed files with 12 additions and 0 deletions

View File

@@ -23,6 +23,14 @@ class BindingSet
@selector = selector.replace(/!important/g, '')
@commandsByKeystrokes = @normalizeCommandsByKeystrokes(commandsByKeystrokes)
# Public:
getSelector: ->
@selector
# Public:
getCommandsByKeystrokes: ->
@commandsByKeystrokes
commandForEvent: (event) ->
for keystrokes, command of @commandsByKeystrokes
return command if event.keystrokes == keystrokes

View File

@@ -54,6 +54,10 @@ class Keymap
keystroke = keystrokes.split(' ')[0]
_.remove(@bindingSetsByFirstKeystroke[keystroke], bindingSet)
# Public: Returns all registered {BindingSet}s.
getBindingSets: ->
@bindingSets
bindKeys: (args...) ->
name = args.shift() if args.length > 2
[selector, bindings] = args