diff options
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 99769fa3c..e121fad6a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -21,6 +21,7 @@ module.exports = class MetamaskController { this.idStore.setStore(this.ethStore) this.messageManager = messageManager this.publicConfigStore = this.initPublicConfigStore() + this.scheduleConversionInterval() } getState () { @@ -241,7 +242,8 @@ module.exports = class MetamaskController { setCurrentFiat (fiat, cb) { try { this.configManager.setCurrentFiat(fiat) - this.configManager.setConversionRate() + this.configManager.updateConversionRate() + this.scheduleConversionInterval() const data = { conversionRate: this.configManager.getConversionRate, currentFiat: this.configManager.getCurrentFiat, @@ -253,6 +255,16 @@ module.exports = class MetamaskController { } } + scheduleConversionInterval () { + if (this.conversionInterval) { + clearInterval(this.conversionInterval) + } + this.conversionInterval = setInterval(() => { + console.log("Updated currency!") + this.configManager.updateConversionRate() + }, 1000) + } + // called from popup setRpcTarget (rpcTarget) { this.configManager.setRpcTarget(rpcTarget) |