aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/settings.coffee
diff options
context:
space:
mode:
authorStephen Blott2014-04-27 11:52:30 +0100
committerStephen Blott2014-04-27 13:25:17 +0100
commitdb65721aa67b2de75b1e279f01e721676e83b448 (patch)
treee5a7be87929d215711c14c1c42f229b6d51f7756 /background_scripts/settings.coffee
parenta9cec9742115a098a031ae7f946eb7bb93648ecd (diff)
downloadvimium-db65721aa67b2de75b1e279f01e721676e83b448.tar.bz2
Response to @philc's comments regarding sync.
Diffstat (limited to 'background_scripts/settings.coffee')
-rw-r--r--background_scripts/settings.coffee13
1 files changed, 5 insertions, 8 deletions
diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee
index f75c1db3..73a7a04b 100644
--- a/background_scripts/settings.coffee
+++ b/background_scripts/settings.coffee
@@ -23,10 +23,9 @@ root.Settings = Settings =
has: (key) -> key of localStorage
- # postUpdateHooks are called each time an option changes:
- # either from options/options.coffee (when the options page is saved)
- # or from background_scripts/sync.coffee (when an update propagates from chrome.storage)
- #
+ # for settings which require action when their value changes, add hooks here
+ # called from options/options.coffee (when the options page is saved), and from background_scripts/sync.coffee (when
+ # an update propagates from chrome.storage.sync).
postUpdateHooks:
keyMappings: (value) ->
root.Commands.clearKeyMappingsAndSetDefaults()
@@ -34,10 +33,8 @@ root.Settings = Settings =
root.refreshCompletionKeysAfterMappingSave()
# postUpdateHooks convenience wrapper
- doPostUpdateHook: (key, value) ->
- if @postUpdateHooks[key]
- @postUpdateHooks[key] value
-
+ performPostUpdateHook: (key, value) ->
+ @postUpdateHooks[key] value if @postUpdateHooks[key]
# options/options.(coffee|html) only handle booleans and strings; therefore
# all defaults must be booleans or strings