aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/keyring-controller.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-11-16 09:12:13 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-11-16 09:12:13 +0800
commit5bfb700fa833a415a541a959736d6184d3c07753 (patch)
tree7839d889016500fc4915c55090faad44e3a2d9ca /app/scripts/keyring-controller.js
parente18109f1eac855a828dc5c6011bbc8a4dbc69f4c (diff)
downloadtangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.gz
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.bz2
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.lz
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.xz
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.zst
tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.zip
Minimize dispatches by using emitters and relying on state updates.
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r--app/scripts/keyring-controller.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index e635ad285..280b332a0 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -108,7 +108,7 @@ module.exports = class KeyringController extends EventEmitter {
this.setupAccounts(accounts)
this.emit('update')
- cb(null, this.getState())
+ cb()
})
})
}
@@ -163,7 +163,7 @@ module.exports = class KeyringController extends EventEmitter {
this.setupAccounts(accounts)
this.persistAllKeyrings()
.then(() => {
- cb(err, this.getState())
+ cb(err)
})
.catch((reason) => {
cb(reason)
@@ -173,9 +173,7 @@ module.exports = class KeyringController extends EventEmitter {
placeSeedWords () {
const firstKeyring = this.keyrings[0]
- console.log(firstKeyring)
const seedWords = firstKeyring.serialize().mnemonic
- console.log(seedWords)
this.configManager.setSeedWords(seedWords)
}
@@ -188,7 +186,7 @@ module.exports = class KeyringController extends EventEmitter {
this.keyrings = keyrings
this.setupAccounts()
this.emit('update')
- cb(null, this.getState())
+ cb()
})
.catch((err) => {
console.error(err)
@@ -215,7 +213,7 @@ module.exports = class KeyringController extends EventEmitter {
this.setupAccounts(accounts)
this.persistAllKeyrings()
.then(() => {
- cb(null, this.getState())
+ cb()
})
.catch((reason) => {
cb(reason)
@@ -228,7 +226,7 @@ module.exports = class KeyringController extends EventEmitter {
this.setupAccounts(accounts)
this.persistAllKeyrings()
.then(() => {
- cb(null, this.getState())
+ cb()
})
.catch((reason) => {
cb(reason)
@@ -521,6 +519,7 @@ module.exports = class KeyringController extends EventEmitter {
setLocked (cb) {
this.key = null
this.keyrings = []
+ this.emit('update')
cb()
}