From 8cd164ef5e5184fbddb9f3e39c87a7c0ae277ae5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 6 Feb 2014 16:39:23 -0800 Subject: [PATCH] :memo: doc parameters in keymap.coffee --- src/keymap.coffee | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/keymap.coffee b/src/keymap.coffee index 1f71f3ff3..8fccf060d 100644 --- a/src/keymap.coffee +++ b/src/keymap.coffee @@ -43,10 +43,8 @@ class Keymap # Public: Returns a array of {KeyBinding}s (sorted by selector specificity) # that match a keystroke and element. # - # * keystroke: - # The string representing the keys pressed (e.g. ctrl-P). - # * element: - # The DOM node that will match a {KeyBinding}'s selector. + # keystroke - The {String} representing the keys pressed (e.g. ctrl-P). + # element - The DOM node that will match a {KeyBinding}'s selector. keyBindingsForKeystrokeMatchingElement: (keystroke, element) -> keyBindings = @keyBindingsForKeystroke(keystroke) @keyBindingsMatchingElement(element, keyBindings) @@ -54,41 +52,37 @@ class Keymap # Public: Returns a array of {KeyBinding}s (sorted by selector specificity) # that match a command. # - # * command: - # The string representing the command (tree-view:toggle) - # * element: - # The DOM node that will match a {KeyBinding}'s selector. + # command - The {String} representing the command (tree-view:toggle). + # element - The DOM node that will match a {KeyBinding}'s selector. keyBindingsForCommandMatchingElement: (command, element) -> keyBindings = @keyBindingsForCommand(command) @keyBindingsMatchingElement(element, keyBindings) # Public: Returns an array of {KeyBinding}s that match a keystroke - # * keystroke: - # The string representing the keys pressed (e.g. ctrl-P) + # + # keystroke: The {String} representing the keys pressed (e.g. ctrl-P) keyBindingsForKeystroke: (keystroke) -> keystroke = KeyBinding.normalizeKeystroke(keystroke) @keyBindings.filter (keyBinding) -> keyBinding.matches(keystroke) # Public: Returns an array of {KeyBinding}s that match a command - # * keystroke: - # The string representing the keys pressed (e.g. ctrl-P) + # + # keystroke - The {String} representing the keys pressed (e.g. ctrl-P) keyBindingsForCommand: (command) -> @keyBindings.filter (keyBinding) -> keyBinding.command == command # Public: Returns a array of {KeyBinding}s (sorted by selector specificity) # whos selector matches the element. # - # * element: - # The DOM node that will match a {KeyBinding}'s selector. + # element - The DOM node that will match a {KeyBinding}'s selector. keyBindingsMatchingElement: (element, keyBindings=@keyBindings) -> keyBindings = keyBindings.filter ({selector}) -> $(element).closest(selector).length > 0 keyBindings.sort (a, b) -> a.compare(b) # Public: Returns a keystroke string derived from an event. - # * event: - # A DOM or jQuery event - # * previousKeystroke: - # An optional string used for multiKeystrokes + # + # event - A DOM or jQuery event. + # previousKeystroke - An optional string used for multiKeystrokes. keystrokeStringForEvent: (event, previousKeystroke) -> if event.originalEvent.keyIdentifier.indexOf('U+') == 0 hexCharCode = event.originalEvent.keyIdentifier[2..]