1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

background - fix metamaskController store -> diskStore persistence

This commit is contained in:
kumavis 2017-01-12 14:40:04 -08:00
parent 80514d73b5
commit bc1615f032

View File

@ -5,6 +5,7 @@ const asyncQ = require('async-q')
const Migrator = require('./lib/migrator/') const Migrator = require('./lib/migrator/')
const migrations = require('./lib/migrations/') const migrations = require('./lib/migrations/')
const LocalStorageStore = require('./lib/observable/local-storage') const LocalStorageStore = require('./lib/observable/local-storage')
const synchronizeStore = require('./lib/observable/util/sync')
const PortStream = require('./lib/port-stream.js') const PortStream = require('./lib/port-stream.js')
const notification = require('./lib/notifications.js') const notification = require('./lib/notifications.js')
const messageManager = require('./lib/message-manager') const messageManager = require('./lib/message-manager')
@ -68,7 +69,11 @@ function setupController (initState) {
global.metamaskController = controller global.metamaskController = controller
// setup state persistence // 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 // connect to other contexts