diff options
background - fix metamaskController store -> diskStore persistence
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r-- | app/scripts/background.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index 0e5a76d51..1f269da7b 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -5,6 +5,7 @@ const asyncQ = require('async-q') const Migrator = require('./lib/migrator/') const migrations = require('./lib/migrations/') const LocalStorageStore = require('./lib/observable/local-storage') +const synchronizeStore = require('./lib/observable/util/sync') const PortStream = require('./lib/port-stream.js') const notification = require('./lib/notifications.js') const messageManager = require('./lib/message-manager') @@ -68,7 +69,11 @@ function setupController (initState) { global.metamaskController = controller // setup state persistence - controller.store.subscribe((newState) => diskStore) + synchronizeStore(controller.store, diskStore, (state) => { + let versionedData = diskStore.get() + versionedData.data = state + return versionedData + }) // // connect to other contexts |