aboutsummaryrefslogtreecommitdiffstats
path: root/ui/index.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-04-01 04:20:16 +0800
committerkumavis <aaron@kumavis.me>2017-04-01 04:20:16 +0800
commit49d8877fd78b8251b6856292ca71a55773a74b0e (patch)
tree7f67d5c2f9048c12db05ad6f4485494f3d7fd45e /ui/index.js
parent0ef679388a9604c39a432408826c080d2d17c221 (diff)
downloadtangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar.gz
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar.bz2
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar.lz
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar.xz
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.tar.zst
tangerine-wallet-browser-49d8877fd78b8251b6856292ca71a55773a74b0e.zip
ui - startPopup returns store after boot
Diffstat (limited to 'ui/index.js')
-rw-r--r--ui/index.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/ui/index.js b/ui/index.js
index 1a65f813c..e3648c374 100644
--- a/ui/index.js
+++ b/ui/index.js
@@ -4,27 +4,28 @@ const Root = require('./app/root')
const actions = require('./app/actions')
const configureStore = require('./app/store')
const txHelper = require('./lib/tx-helper')
-module.exports = launchApp
+global.log = require('loglevel')
-let debugMode = window.METAMASK_DEBUG
-const log = require('loglevel')
-window.log = log
-log.setLevel(debugMode ? 'debug' : 'warn')
+module.exports = launchMetamaskUi
-function launchApp (opts) {
+
+log.setLevel(global.METAMASK_DEBUG ? 'debug' : 'warn')
+
+function launchMetamaskUi (opts, cb) {
var accountManager = opts.accountManager
actions._setBackgroundConnection(accountManager)
// check if we are unlocked first
accountManager.getState(function (err, metamaskState) {
- if (err) throw err
- startApp(metamaskState, accountManager, opts)
+ if (err) return cb(err)
+ const store = startApp(metamaskState, accountManager, opts)
+ cb(null, store)
})
}
function startApp (metamaskState, accountManager, opts) {
// parse opts
- var store = configureStore({
+ const store = configureStore({
// metamaskState represents the cross-tab state
metamask: metamaskState,
@@ -37,7 +38,7 @@ function startApp (metamaskState, accountManager, opts) {
})
// if unconfirmed txs, start on txConf page
- var unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.network)
+ const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.network)
if (unapprovedTxsAll.length > 0) {
store.dispatch(actions.showConfTxPage())
}
@@ -53,4 +54,6 @@ function startApp (metamaskState, accountManager, opts) {
store: store,
}
), opts.container)
+
+ return store
}