aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-10-10 13:55:47 +0100
committerGitHub2016-10-10 13:55:47 +0100
commit1eb6bfdcad6d7091911e395083afe1148b2a4c76 (patch)
tree0dc625f101fbd7d2e49b73c71f067fda628d97f4 /lib/utils.coffee
parenta3c4b530f24ee8bc1f9a1219cf35fb87a1aa0402 (diff)
parent0346b2d971ffab26a8d37946aca1c550b316e317 (diff)
downloadvimium-1eb6bfdcad6d7091911e395083afe1148b2a4c76.tar.bz2
Merge pull request #2306 from smblott-github/add-key-translation
Add "mapkey" command for key mappings.
Diffstat (limited to 'lib/utils.coffee')
-rw-r--r--lib/utils.coffee7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index c06d8ac5..5a028186 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -209,6 +209,13 @@ Utils =
makeIdempotent: (func) ->
(args...) -> ([previousFunc, func] = [func, null])[0]? args...
+ monitorChromeStorage: (key, setter) ->
+ # NOTE: "?" here for the tests.
+ chrome?.storage.local.get key, (obj) =>
+ setter obj[key] if obj[key]?
+ chrome.storage.onChanged.addListener (changes, area) =>
+ setter changes[key].newValue if changes[key]?.newValue?
+
# Utility for parsing and using the custom search-engine configuration. We re-use the previous parse if the
# search-engine configuration is unchanged.
SearchEngines =