aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2017-06-16 10:27:18 +0800
committerGitHub <noreply@github.com>2017-06-16 10:27:18 +0800
commitfc3f83ac7480af43e0f91f36a6c64f61c2981f3c (patch)
tree999fc2fd4145dc484d756612671d177fa895fcdb
parent7d64dbf19cc6a9e4699af92097be3f88a16d3d35 (diff)
parent06f6aa7a00f57004746d1e21759ac56396d9b855 (diff)
downloadtangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar.gz
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar.bz2
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar.lz
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar.xz
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.tar.zst
tangerine-wallet-browser-fc3f83ac7480af43e0f91f36a6c64f61c2981f3c.zip
Merge pull request #1622 from MetaMask/i1621-DebounceBackgroundUpdates
Debounce background updates
-rw-r--r--app/scripts/metamask-controller.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index a7eb3d056..d745d29dc 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -23,6 +23,7 @@ const autoFaucet = require('./lib/auto-faucet')
const nodeify = require('./lib/nodeify')
const accountImporter = require('./account-import-strategies')
const getBuyEthUrl = require('./lib/buy-eth-url')
+const debounce = require('debounce')
const version = require('../manifest.json').version
@@ -30,6 +31,9 @@ module.exports = class MetamaskController extends EventEmitter {
constructor (opts) {
super()
+
+ this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200)
+
this.opts = opts
const initState = opts.initState || {}
@@ -354,7 +358,7 @@ module.exports = class MetamaskController extends EventEmitter {
)
}
- sendUpdate () {
+ privateSendUpdate () {
this.emit('update', this.getState())
}