Removed networkcallid in updateNetwork function.

pull/1/head
ioedeveloper 5 years ago
parent fedf6d8561
commit 61189b4519
  1. 2
      src/app/tabs/runTab/contractDropdown.js
  2. 1
      src/app/tabs/runTab/settings.js
  3. 5
      src/blockchain/blockchain.js

@ -49,7 +49,7 @@ class ContractDropdownUI {
} }
listenToContextChange () { listenToContextChange () {
this.blockchain.event.register('newExecutionContext', () => { this.blockchain.event.register('contextChanged', () => {
this.blockchain.updateNetwork((err, {name} = {}) => { this.blockchain.updateNetwork((err, {name} = {}) => {
if (err) { if (err) {
console.log(`can't detect network`) console.log(`can't detect network`)

@ -212,7 +212,6 @@ class SettingsUI {
this.event.trigger('clearInstance', []) this.event.trigger('clearInstance', [])
this.updateNetwork() this.updateNetwork()
this.updatePlusButton() this.updatePlusButton()
this.blockchain.event.trigger('newExecutionContext', [])
} }
updatePlusButton () { updatePlusButton () {

@ -196,17 +196,12 @@ class Blockchain {
} }
updateNetwork (cb) { updateNetwork (cb) {
this.networkcallid++
((callid) => {
this.executionContext.detectNetwork((err, { id, name } = {}) => { this.executionContext.detectNetwork((err, { id, name } = {}) => {
if (this.networkcallid > callid) return
this.networkcallid++
if (err) { if (err) {
return cb(err) return cb(err)
} }
cb(null, {id, name}) cb(null, {id, name})
}) })
})(this.networkcallid)
} }
detectNetwork (cb) { detectNetwork (cb) {

Loading…
Cancel
Save