         for own key, value of items
           Settings.storeAndPropagate key, value if @shouldSyncKey key
         Settings.isLoaded = true
+        unless isPreloaded
+          listener() while listener = Settings.eventListeners.load?.pop()
 
   # Asynchronous message from synced storage.
   handleStorageUpdate: (changes, area) ->

    Sync.clear key

  has: (key) -> key of @cache

  # For settings which require action when their value changes, add hooks to this object, to be called from
  # options/options.coffee (when the options page is saved), and by Settings.storeAndPropagate (when an

root.Settings = Settings =
  isLoaded: isPreloaded
  cache: settingsCache
  eventListeners: {}

  init: ->
    Sync.init()
    if isPreloaded
      listener() while listener = Settings.eventListeners.load?.pop()

  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]
