Update execution-context.js

pull/5370/head
yann300 6 years ago
parent 9a0f81e36d
commit 6996d905bd
  1. 8
      remix-lib/src/execution/execution-context.js

@ -1,3 +1,4 @@
/* global ethereum */
'use strict'
var Web3 = require('web3')
var EventManager = require('../eventManager')
@ -96,9 +97,15 @@ function ExecutionContext () {
executionContext = 'vm'
} else {
executionContext = injectedProvider ? 'injected' : 'vm'
if (executionContext === 'injected') this.askPermission()
}
}
this.askPermission = function () {
// metamask
if (ethereum && typeof ethereum.enable === 'function') ethereum.enable()
}
this.getProvider = function () {
return executionContext
}
@ -190,6 +197,7 @@ function ExecutionContext () {
infoCb(alertMsg)
return cb()
} else {
self.askPermission()
executionContext = context
web3.setProvider(injectedProvider)
self._updateBlockGasLimit()

Loading…
Cancel
Save