aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/commands.coffee7
1 files changed, 3 insertions, 4 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 6c452242..b58a3b0c 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -1,7 +1,7 @@
Commands =
init: ->
- for own command, description of commandDescriptions
- @addCommand(command, description[0], description[1])
+ for own command, descriptor of commandDescriptions
+ @addCommand(command, descriptor[0], descriptor[1])
@loadKeyMappings Settings.get "keyMappings"
Settings.postUpdateHooks["keyMappings"] = @loadKeyMappings.bind this
@@ -18,12 +18,11 @@ Commands =
# - background: whether this command needs to be run against the background page.
# - passCountToFunction: true if this command should have any digits which were typed prior to the
# command passed to it. This is used to implement e.g. "closing of 3 tabs".
- addCommand: (command, description, options) ->
+ addCommand: (command, description, options = {}) ->
if command of @availableCommands
BgUtils.log "#{command} is already defined! Check commands.coffee for duplicates."
return
- options ||= {}
@availableCommands[command] = extend options, description: description
mapKeyToCommand: ({ key, command, options }) ->