mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 12:56:01 +01:00
Merge pull request #1622 from MetaMask/i1621-DebounceBackgroundUpdates
Debounce background updates
This commit is contained in:
commit
fc3f83ac74
@ -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())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user