Simplify confusing and error-provoking context conditionals in executionContextChange

pull/1/head
holgerd77 7 years ago
parent 70c7710b56
commit 44390f5429
  1. 32
      src/execution-context.js

@ -128,25 +128,29 @@ function ExecutionContext () {
}) })
} }
if (context === 'web3') { if (context === 'vm') {
modalDialogCustom.confirm(null, 'Are you sure you want to connect to an ethereum node?', executionContext = context
() => { runPrompt(endPointUrl) }, () => { cb() } vm.stateManager.revert(function () {
) vm.stateManager.checkpoint()
} else if (context === 'injected' && injectedProvider === undefined) { })
cb() self.event.trigger('contextChanged', ['vm'])
} else { }
if (context === 'injected') {
if (context === 'injected') {
if (injectedProvider === undefined) {
cb()
} else {
executionContext = context executionContext = context
web3.setProvider(injectedProvider) web3.setProvider(injectedProvider)
self.event.trigger('contextChanged', ['injected']) self.event.trigger('contextChanged', ['injected'])
} else if (context === 'vm') {
executionContext = context
vm.stateManager.revert(function () {
vm.stateManager.checkpoint()
})
self.event.trigger('contextChanged', ['vm'])
} }
} }
if (context === 'web3') {
modalDialogCustom.confirm(null, 'Are you sure you want to connect to an ethereum node?',
() => { runPrompt(endPointUrl) }, () => { cb() }
)
}
} }
this.currentblockGasLimit = function () { this.currentblockGasLimit = function () {

Loading…
Cancel
Save