aboutsummaryrefslogtreecommitdiffstats
path: root/ui/index.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-04-03 14:04:55 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-04-03 14:04:55 +0800
commitf81fdbc34ff037ab64a9f4c98100304e7b1132e4 (patch)
tree20f2a75068af1b4b13ecb9a9b6276e07af94de93 /ui/index.js
parent89c924101e3ff52849c5a82ced7e058e1fa39dfd (diff)
parent235a70b9392d8b87eae4fc141e7f0be1d7788ee2 (diff)
downloadtangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar.gz
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar.bz2
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar.lz
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar.xz
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.tar.zst
tangerine-wallet-browser-f81fdbc34ff037ab64a9f4c98100304e7b1132e4.zip
Merge branch 'master' into mascara
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 16875fce4..a729138d3 100644
--- a/ui/index.js
+++ b/ui/index.js
@@ -4,26 +4,27 @@ 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,
@@ -36,7 +37,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())
}
@@ -52,4 +53,6 @@ function startApp (metamaskState, accountManager, opts) {
store: store,
}
), opts.container)
+
+ return store
}