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

Fix first install flow

This commit is contained in:
frankiebee 2017-04-04 11:08:10 +02:00
parent 5baa4fd896
commit 16c24db13b
2 changed files with 4 additions and 11 deletions

View File

@ -1,5 +1,4 @@
global.window = global global.window = global
const asyncQ = require('async-q')
const pipe = require('pump') const pipe = require('pump')
const SwGlobalListener = require('sw-stream/lib/sw-global-listener.js') const SwGlobalListener = require('sw-stream/lib/sw-global-listener.js')
@ -39,18 +38,12 @@ console.log('inside:open')
let diskStore let diskStore
const dbController = new DbController({ const dbController = new DbController({
key: STORAGE_KEY, key: STORAGE_KEY,
global: self,
version: 2, version: 2,
}) })
asyncQ.waterfall([ loadStateFromPersistence()
() => loadStateFromPersistence(), .then((initState) => setupController(initState))
(initState) => setupController(initState),
])
.then(() => console.log('MetaMask initialization complete.')) .then(() => console.log('MetaMask initialization complete.'))
.catch((err) => { .catch((err) => console.error('WHILE SETTING UP:', err))
console.log('WHILE SETTING UP:')
console.error(err)
})
// initialization flow // initialization flow

View File

@ -38,7 +38,7 @@ module.exports = class IndexDbController extends EventEmitter {
if (!data) { if (!data) {
return this._add('dataStore', this.initialState) return this._add('dataStore', this.initialState)
.then(() => this.get('dataStore')) .then(() => this.get('dataStore'))
.then((versionedData) => Promise.resolve(versionedData.data)) .then((versionedData) => Promise.resolve(versionedData))
} }
return Promise.resolve(data) return Promise.resolve(data)
}) })