diff options
| author | Stephen Blott | 2016-02-28 09:44:55 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-05 05:38:30 +0000 |
| commit | 1ae95161b021fc9a64e139485b0dac047a874c0e (patch) | |
| tree | fc1e8d38d172e636569037a70dd3e9977af7b950 | |
| parent | 5d918f75715cc2c595a77f1e9dc8fe545fabb663 (diff) | |
| download | vimium-1ae95161b021fc9a64e139485b0dac047a874c0e.tar.bz2 | |
Key bindings; simplify Commands initialization.
| -rw-r--r-- | background_scripts/commands.coffee | 17 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 1 |
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 = -> |
