aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-07-22 07:44:50 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-07-22 07:44:50 +0800
commita612fcee64422ca43c470d7832a263f5e490611d (patch)
treec6cd96d20a9dfb9d0ebc9d9a66a364d94ee60870 /app/scripts/metamask-controller.js
parent716e65424d2ba490a384bfc1f0591685eb2867fa (diff)
downloadtangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar.gz
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar.bz2
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar.lz
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar.xz
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.tar.zst
tangerine-wallet-browser-a612fcee64422ca43c470d7832a263f5e490611d.zip
Change function names. Add interval polling for api. Refactor functions.
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js14
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)