aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/detect-tokens.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/controllers/detect-tokens.js')
-rw-r--r--app/scripts/controllers/detect-tokens.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/app/scripts/controllers/detect-tokens.js b/app/scripts/controllers/detect-tokens.js
index f1810cfa1..b30dc00f1 100644
--- a/app/scripts/controllers/detect-tokens.js
+++ b/app/scripts/controllers/detect-tokens.js
@@ -64,10 +64,9 @@ class DetectTokensController {
*
*/
restartTokenDetection () {
- if (this.isActive && this.selectedAddress) {
- this.detectNewTokens()
- this.interval = DEFAULT_INTERVAL
- }
+ if (!(this.isActive && this.selectedAddress)) { return }
+ this.detectNewTokens()
+ this.interval = DEFAULT_INTERVAL
}
/**
@@ -113,11 +112,19 @@ class DetectTokensController {
this._keyringMemStore = keyringMemStore
this._keyringMemStore.subscribe(({ isUnlocked }) => {
if (this.isUnlocked !== isUnlocked) {
- if (isUnlocked) { this.restartTokenDetection() }
this.isUnlocked = isUnlocked
+ if (isUnlocked) { this.restartTokenDetection() }
}
})
}
+
+ /**
+ * Internal isActive state
+ * @type {Object}
+ */
+ get isActive () {
+ return this.isOpen && this.isUnlocked
+ }
}
module.exports = DetectTokensController