aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/commands.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts/commands.coffee')
-rw-r--r--background_scripts/commands.coffee17
1 files changed, 9 insertions, 8 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 9348e3c5..de03136e 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -1,7 +1,14 @@
Commands =
- init: ->
+ init: (customKeyMappings) ->
for own command, description of commandDescriptions
@addCommand(command, description[0], description[1])
+ @loadKeyMappings customKeyMappings
+ Settings.postUpdateHooks["keyMappings"] = @loadKeyMappings.bind this
+
+ loadKeyMappings: (value) ->
+ @clearKeyMappingsAndSetDefaults()
+ @parseCustomKeyMappings value
+ @generateKeyStateStructure()
availableCommands: {}
keyToCommandRegistry: {}
@@ -391,13 +398,7 @@ commandDescriptions =
"Marks.activateCreateMode": ["Create a new mark", { noRepeat: true }]
"Marks.activateGotoMode": ["Go to a mark", { noRepeat: true }]
-Commands.init()
-
-# Register postUpdateHook for keyMappings setting.
-Settings.postUpdateHooks["keyMappings"] = (value) ->
- Commands.clearKeyMappingsAndSetDefaults()
- Commands.parseCustomKeyMappings value
- Commands.generateKeyStateStructure()
+Commands.init Settings.get "keyMappings"
root = exports ? window
root.Commands = Commands