aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/commands.coffee17
-rw-r--r--background_scripts/main.coffee1
2 files changed, 9 insertions, 9 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
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 7975ec6d..f5bf90a6 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -481,7 +481,6 @@ window.runTests = -> open(chrome.runtime.getURL('tests/dom_tests/dom_tests.html'
#
# Begin initialization.
#
-Settings.postUpdateHooks["keyMappings"] Settings.get "keyMappings"
# Show notification on upgrade.
showUpgradeMessage = ->