aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee3
-rw-r--r--background_scripts/sync.coffee6
2 files changed, 7 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index f564f477..dc853803 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -596,3 +596,6 @@ chrome.windows.getAll { populate: true }, (windows) ->
createScrollPositionHandler = ->
(response) -> updateScrollPosition(tab, response.scrollX, response.scrollY) if response?
chrome.tabs.sendMessage(tab.id, { name: "getScrollPosition" }, createScrollPositionHandler())
+
+# Start pulling changes from synchrized storage.
+Sync.init()
diff --git a/background_scripts/sync.coffee b/background_scripts/sync.coffee
index 3b34c5a6..b1ccb696 100644
--- a/background_scripts/sync.coffee
+++ b/background_scripts/sync.coffee
@@ -25,9 +25,11 @@ root.Sync = Sync =
storage: chrome.storage.sync
doNotSync: [ "settingsVersion", "previousVersion" ]
+ register: ->
+ chrome.storage.onChanged.addListener (changes, area) -> Sync.listener changes, area
+
init: ->
chrome.storage.onChanged.addListener (changes, area) -> Sync.listener changes, area
- @pull()
# Asynchronous fetch from synced storage, called only at startup.
pull: ->
@@ -126,5 +128,5 @@ root.Sync = Sync =
return false
return true
-Sync.init()
+Sync.register()