diff options
| author | mrmr1993 | 2015-05-31 14:03:48 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2015-05-31 14:03:48 +0100 | 
| commit | c753194941b3c7a6df8ff328fa36b71c854bc26a (patch) | |
| tree | f2aa472c28ea3f95ab855ebd4a913d8bbb0ce095 /lib/settings.coffee | |
| parent | a51a4724c76d1eb644d5dcba3783f27d56d65e6b (diff) | |
| download | vimium-c753194941b3c7a6df8ff328fa36b71c854bc26a.tar.bz2 | |
Add Settings.isLoaded to the unified settings implementation
Diffstat (limited to 'lib/settings.coffee')
| -rw-r--r-- | lib/settings.coffee | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/settings.coffee b/lib/settings.coffee index dd667dbd..2dd6722b 100644 --- a/lib/settings.coffee +++ b/lib/settings.coffee @@ -30,6 +30,7 @@ Sync =        unless chrome.runtime.lastError          for own key, value of items            Settings.storeAndPropagate key, value if @shouldSyncKey key +        Settings.isLoaded = true    # Asynchronous message from synced storage.    handleStorageUpdate: (changes, area) -> @@ -58,15 +59,20 @@ Sync =  if Utils.isExtensionPage()    if Utils.isBackgroundPage()      settingsCache = localStorage +    isPreloaded = true    else      settingsCache = extend {}, localStorage # Make a copy of the cached settings from localStorage +    isPreloaded = true  else    settingsCache = {} +  isPreloaded = false  root.Settings = Settings = +  isLoaded: isPreloaded    cache: settingsCache    init: -> Sync.init()    get: (key) -> +    console.log "WARNING: Settings have not loaded yet; using the default value for #{key}." unless @isLoaded      if (key of @cache) then JSON.parse(@cache[key]) else @defaults[key]    set: (key, value) ->  | 
