Skip to content

Commit

Permalink
Document options/settings data model.
Browse files Browse the repository at this point in the history
  • Loading branch information
smblott-github committed Jun 20, 2015
1 parent 8415064 commit 46e19df
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/settings.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

# A "setting" is a stored key/value pair. An "option" is setting which has a default value and whose value
# can be changed on the options page.
#
# Option values which have never been changed by the user are in Settings.defaults.
#
# Settings whose values have been changed are:
# 1. stored either in chrome.storage.sync or in chrome.storage.local (but never both), and
# 2. cached in Settings.cache; on extension pages, Settings.cache uses localStorage (so it persists).
#
# In all cases except Settings.defaults, values are stored as jsonified strings.

Settings =
storage: chrome.storage.sync
cache: {}
Expand Down Expand Up @@ -159,7 +170,7 @@ if Utils.isBackgroundPage()
chrome.storage.local.set findModeRawQueryList: (if rawQuery then [ rawQuery ] else [])

# Migration (after 1.51, 2015/6/17).
# Copy settings with non-default values (and which are not in synced storage) to chrome.storage.local;
# Copy options with non-default values (and which are not in synced storage) to chrome.storage.local;
# thereby making these settings accessible within content scripts.
do (migrationKey = "copyNonDefaultsToChromeStorage-20150717") ->
unless localStorage[migrationKey]
Expand Down

0 comments on commit 46e19df

Please sign in to comment.