1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Add network loading indication

This commit is contained in:
Dan Finlay 2016-06-03 13:58:09 -07:00
parent d86d7b9ac7
commit 2422c78ce2
2 changed files with 14 additions and 0 deletions

View File

@ -131,8 +131,10 @@ IdentityStore.prototype.revealAccount = function(cb) {
} }
IdentityStore.prototype.getNetwork = function(tries) { IdentityStore.prototype.getNetwork = function(tries) {
if (tries === 0) { if (tries === 0) {
this._currentState.network = 'error' this._currentState.network = 'error'
this._didUpdate()
return return
} }
this.web3.version.getNetwork((err, network) => { this.web3.version.getNetwork((err, network) => {
@ -140,7 +142,11 @@ IdentityStore.prototype.getNetwork = function(tries) {
return this.getNetwork(tries - 1, cb) return this.getNetwork(tries - 1, cb)
} }
this._currentState.network = network this._currentState.network = network
this._didUpdate()
}) })
this._currentState.network = 'loading'
this._didUpdate()
} }
IdentityStore.prototype.setLocked = function(cb){ IdentityStore.prototype.setLocked = function(cb){

View File

@ -19,6 +19,14 @@ Network.prototype.render = function() {
if (networkNumber == undefined || networkNumber == "error") { if (networkNumber == undefined || networkNumber == "error") {
hoverText = 'No Blockchain Connection' hoverText = 'No Blockchain Connection'
iconName = 'no-connection' iconName = 'no-connection'
} else if (networkNumber == 'loading') {
return h('img', {
title: 'Contacting network...',
style: {
width: '27px',
},
src: 'images/loading.svg',
})
} else if (networkNumber == 1) { } else if (networkNumber == 1) {
hoverText = 'Main Ethereum Network' hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network' iconName = 'ethereum-network'