aboutsummaryrefslogtreecommitdiffstats
path: root/ui/index.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-13 04:27:04 +0800
committerGitHub <noreply@github.com>2017-06-13 04:27:04 +0800
commit27220b7bcd5ea1ebdae3bc1b494d28d9c828918c (patch)
treec9385fba3d742ca9cbfb9f3b4c6c9ef29c4f4a1b /ui/index.js
parent57d1a1f1860e50837104a10b7b9f86d398c795ec (diff)
parent8af41f1b0539e70cf4c6e1f4a9f4b10ad13656fc (diff)
downloadtangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.gz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.bz2
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.lz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.xz
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.tar.zst
tangerine-wallet-browser-27220b7bcd5ea1ebdae3bc1b494d28d9c828918c.zip
Merge branch 'master' into i#1203MainNetSwitch
Diffstat (limited to 'ui/index.js')
-rw-r--r--ui/index.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/ui/index.js b/ui/index.js
index 1a65f813c..a729138d3 100644
--- a/ui/index.js
+++ b/ui/index.js
@@ -4,27 +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,
@@ -37,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())
}
@@ -53,4 +53,6 @@ function startApp (metamaskState, accountManager, opts) {
store: store,
}
), opts.container)
+
+ return store
}